{"id":13602621,"url":"https://github.com/electron/search-with-your-keyboard","last_synced_at":"2025-10-01T12:31:19.680Z","repository":{"id":32517204,"uuid":"135935123","full_name":"electron/search-with-your-keyboard","owner":"electron","description":"Add keyboard navigation to your existing client-side search interface.","archived":true,"fork":false,"pushed_at":"2022-12-02T23:14:32.000Z","size":911,"stargazers_count":10,"open_issues_count":14,"forks_count":11,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T00:00:44.490Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/electron.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-03T19:45:09.000Z","updated_at":"2022-12-05T09:28:20.000Z","dependencies_parsed_at":"2023-01-14T21:30:43.997Z","dependency_job_id":null,"html_url":"https://github.com/electron/search-with-your-keyboard","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fsearch-with-your-keyboard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fsearch-with-your-keyboard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fsearch-with-your-keyboard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/electron%2Fsearch-with-your-keyboard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/electron","download_url":"https://codeload.github.com/electron/search-with-your-keyboard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234801645,"owners_count":18888942,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T18:01:31.980Z","updated_at":"2025-10-01T12:31:14.394Z","avatar_url":"https://github.com/electron.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# search-with-your-keyboard\n\n\u003e Add keyboard navigation to your existing client-side search interface.\n\nThis module is designed to make [Algolia InstantSearch] results (aka \"hits\") navigable\nwith a keyboard. It's not Algolia-specific though, and should work with any\nsearch setup so long as it includes a search input and a list of\nclient-side-updated results.\n\n## Behavior\n\nKey | Action\n--- | ------\n\u003ckbd\u003e/\u003c/kbd\u003e | Focuses the search input.\n\u003ckbd\u003eesc\u003c/kbd\u003e | Focuses the search input and clears it.\n\u003ckbd\u003edown\u003c/kbd\u003e | Adds an `active` class to the next (visible) hit. Only applies when the search input contains a value.\n\u003ckbd\u003eup\u003c/kbd\u003e | Adds an `active` class to the previous (visible) hit. If already on the first search hit, the search input is focused. Only applies when the search input contains a value.\n\u003ckbd\u003eenter\u003c/kbd\u003e | Sets `window.location` to the `href` of the first `\u003ca\u003e` tag in the current `.active` hit, if present.\n\u003ckbd\u003ecmdOrCtrl\u003c/kbd\u003e+\u003ckbd\u003eEnter\u003c/kbd\u003e | Opens the window in new tab and focus it.\n\n## Installation\n\n```sh\nnpm install search-with-your-keyboard\n```\n\n## Usage\n\nThe module exports a single function that expects two CSS selector strings as\narguments: one for the input element, one for the set of hit elements.\n\n```js\nconst searchWithYourKeyboard = require('search-with-your-keyboard')\n\nsearchWithYourKeyboard('#search-input', '.ais-hits--item')\n```\n\n## Styles\n\nYou should specify styles for the `.active` class on your hits,\nto make the currently active hit visible to the user. You may want this\nto be the same style as `:hover`ing on a hit:\n\n```css\n.ais-hits--item:hover, .ais-hits--item.active {\n  background-color: #F0F0F0;\n}\n```\n\n## API\n\n### `searchWithYourKeyboard(inputSelector, hitsSelector)`\n\nArguments:\n\n- `inputSelector` String (required) - A CSS selector used to find the search input, e.g. `#search-input`\n- `hitsSelector` String (required) - A CSS selector used to find all hits, e.g. `.ais-hits--item`\n\n## Tests\n\n```sh\nnpm install\nnpm test\n```\n\n## License\n\nMIT\n\n[Algolia InstantSearch]: https://github.com/algolia/instantsearch.js\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Fsearch-with-your-keyboard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felectron%2Fsearch-with-your-keyboard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felectron%2Fsearch-with-your-keyboard/lists"}