{"id":15395029,"url":"https://github.com/goto-bus-stop/dom-autofocus","last_synced_at":"2025-04-15T23:54:03.869Z","repository":{"id":31231948,"uuid":"127288930","full_name":"goto-bus-stop/dom-autofocus","owner":"goto-bus-stop","description":"focus an element when it enters the dom","archived":false,"fork":false,"pushed_at":"2023-05-31T04:58:59.000Z","size":20,"stargazers_count":10,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T03:06:00.941Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/goto-bus-stop.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"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":"2018-03-29T12:34:32.000Z","updated_at":"2023-06-04T06:20:00.000Z","dependencies_parsed_at":"2024-10-19T02:13:06.024Z","dependency_job_id":null,"html_url":"https://github.com/goto-bus-stop/dom-autofocus","commit_stats":{"total_commits":15,"total_committers":2,"mean_commits":7.5,"dds":0.2666666666666667,"last_synced_commit":"9b10eceb4d6e4bccaff5428ca70adb726c35fed0"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goto-bus-stop%2Fdom-autofocus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goto-bus-stop%2Fdom-autofocus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goto-bus-stop%2Fdom-autofocus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/goto-bus-stop%2Fdom-autofocus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/goto-bus-stop","download_url":"https://codeload.github.com/goto-bus-stop/dom-autofocus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249173061,"owners_count":21224481,"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-10-01T15:25:23.442Z","updated_at":"2025-04-15T23:54:03.851Z","avatar_url":"https://github.com/goto-bus-stop.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dom-autofocus\n\nfocus an element when it enters the dom\n\n## Why?\n\nBecause the `autofocus` attribute only works on page load.\n\nThis module uses a [MutationObserver](https://github.com/shama/on-load) to call `.focus()` immediately after the element is mounted.\n\n[![npm][npm-image]][npm-url]\n[![travis][travis-image]][travis-url]\n[![standard][standard-image]][standard-url]\n\n[npm-image]: https://img.shields.io/npm/v/dom-autofocus.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/dom-autofocus\n[travis-image]: https://img.shields.io/travis/goto-bus-stop/dom-autofocus.svg?style=flat-square\n[travis-url]: https://travis-ci.org/goto-bus-stop/dom-autofocus\n[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square\n[standard-url]: http://npm.im/standard\n\n## Install\n\n```\nnpm install dom-autofocus\n```\n\n## Usage\n\n`dom-autofocus` works well with non-virtual DOM diffing libraries like choo:\n\n```js\nvar autofocus = require('dom-autofocus')\nvar html = require('choo/html')\n\nmodule.exports = function view () {\n  return html`\n    \u003cbody\u003e\n      Type here:\n      ${autofocus(html`\n        \u003cinput type=\"text\"\u003e\n      `)}\n    \u003c/body\u003e\n  `\n}\n```\n\n## API\n\n### `el = autofocus(el)`\n\nAutofocus the element when it enters the DOM. Returns the input `el`.\n\n## License\n\n[Apache-2.0](LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoto-bus-stop%2Fdom-autofocus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoto-bus-stop%2Fdom-autofocus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoto-bus-stop%2Fdom-autofocus/lists"}