{"id":19181401,"url":"https://github.com/uid11/auto-set-focus","last_synced_at":"2026-06-16T12:31:48.930Z","repository":{"id":138022378,"uuid":"330581870","full_name":"uid11/auto-set-focus","owner":"uid11","description":"Browser script for auto-setting focus on some element on page.","archived":false,"fork":false,"pushed_at":"2021-01-26T10:24:07.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T02:20:04.578Z","etag":null,"topics":["auto","focus"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uid11.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-18T07:02:36.000Z","updated_at":"2021-01-26T10:24:10.000Z","dependencies_parsed_at":null,"dependency_job_id":"56670ed5-c6a5-412c-b79e-5560240a06cf","html_url":"https://github.com/uid11/auto-set-focus","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uid11/auto-set-focus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uid11%2Fauto-set-focus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uid11%2Fauto-set-focus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uid11%2Fauto-set-focus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uid11%2Fauto-set-focus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uid11","download_url":"https://codeload.github.com/uid11/auto-set-focus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uid11%2Fauto-set-focus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34406820,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["auto","focus"],"created_at":"2024-11-09T10:53:15.151Z","updated_at":"2026-06-16T12:31:48.908Z","avatar_url":"https://github.com/uid11.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# auto-set-focus\n\n[![Contributor Covenant][contributor-covenant-image]](CODE_OF_CONDUCT.md)\n[![code style: prettier][prettier-image]](https://github.com/prettier/prettier)\n[![Conventional Commits][conventional-commits-image]](https://conventionalcommits.org)\n[![No dependencies][dependencies-none-image]](package.json)\n[![License MIT][license-image]](LICENSE)\n\nBrowser script for auto-setting focus on some element on page.\n\nThe index file exports the `autoSetFocus` function as a default value.\n\nWhen called, the `autoSetFocus(element)` function adds a `keydown` event handler\nand a `visibilitychange` event handler.\n\nThen, each time a key is pressed on the page, this `keydown` handler checks\nwhich element on the page has focus.\n\nIf the focus is on some control for entering text, the handler does nothing.\nOtherwise (when neither text input element has focus),\nthe handler clears the text in the element field, and places the focus on element.\n\nThe `visibilitychange` handler place the focus on element, when user return on\nthe page from other windows or tabs.\n\nFinally, `autoSetFocus(element)` returns a `dispose` function that, when called,\nremoves the `keypdown` and `visibilitychange` handlers:\n\n```js\nconst dispose = autoSetFocus(someInputElement);\n\n// ...\n\n// later, when you need to dispose auto-set-focus\ndispose();\n```\n\n## License\n\n[MIT](LICENSE)\n\n[contributor-covenant-image]: https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg 'Contributor Covenant'\n[conventional-commits-image]: https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg 'Conventional Commits'\n[dependencies-none-image]: https://img.shields.io/badge/dependencies-none-brightgreen 'No dependencies'\n[license-image]: https://img.shields.io/badge/license-MIT-blue.svg 'The MIT License'\n[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg 'Prettier code style'\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuid11%2Fauto-set-focus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuid11%2Fauto-set-focus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuid11%2Fauto-set-focus/lists"}