genicsblog / theme-files

Theme files for genicsblog.com
https://staging.genicsblog.com
Other
8 stars 11 forks source link

Search bar is not working as desired #35

Closed siddharth-sable closed 2 years ago

siddharth-sable commented 2 years ago

Pressing Ctrl+K should bring up the search bar, it doesn't.

Change the Key to appropriate one, so that the search bar works as desired.

shockz09 commented 2 years ago

image ?

gouravkhunger commented 2 years ago

more context: it opens up google bar instead of genics search bar on browsers like brave, chrome and edge on windows.

Probably changing Ctrl / Command + K short cut to Ctrl / Command + / should work. Otherwise people have to disable google search bar shortcut from settings.

AnupT16 commented 2 years ago

@gouravkhunger

document.addEventListener("keydown", function (e) {
  if (e.keyCode === 75 && (e.ctrlKey || e.metaKey)) {
    e.preventDefault();
    showSearch();
  }

  if (e.keyCode === 27) {
    hideSearch();
  }
});
shockz09 commented 2 years ago

did u test it?

AnupT16 commented 2 years ago

@shockz09 i have used it before and it works for most of browsers but if you want it support on every browser u should use jquery

shockz09 commented 2 years ago

cool

gouravkhunger commented 2 years ago

Hey @AnupT16, Thanks for the idea! I'll test the e.preventDefault() thing on windows today (macOS and Linux didn't have such an issue that's why it went unnoticed)

gouravkhunger commented 2 years ago

Fixed in #36 😄 Thank you everyone!