{"id":24911425,"url":"https://github.com/accessible-ui/tabbable","last_synced_at":"2025-03-28T03:14:39.313Z","repository":{"id":40795184,"uuid":"228280290","full_name":"accessible-ui/tabbable","owner":"accessible-ui","description":"🅰 Returns an array of all tabbable DOM nodes within a containing node.","archived":false,"fork":false,"pushed_at":"2023-01-06T02:21:11.000Z","size":2576,"stargazers_count":1,"open_issues_count":16,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-17T19:47:31.571Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/accessible-ui.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-16T01:41:20.000Z","updated_at":"2020-07-07T15:01:57.000Z","dependencies_parsed_at":"2023-02-05T02:46:35.235Z","dependency_job_id":null,"html_url":"https://github.com/accessible-ui/tabbable","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Ftabbable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Ftabbable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Ftabbable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/accessible-ui%2Ftabbable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/accessible-ui","download_url":"https://codeload.github.com/accessible-ui/tabbable/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245960812,"owners_count":20700781,"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":"2025-02-02T04:20:06.708Z","updated_at":"2025-03-28T03:14:38.256Z","avatar_url":"https://github.com/accessible-ui.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003chr\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ch1 align=\"center\"\u003e\n    tabbable()\n  \u003c/h1\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://bundlephobia.com/result?p=@accessible/tabbable\"\u003e\n    \u003cimg alt=\"Bundlephobia\" src=\"https://img.shields.io/bundlephobia/minzip/@accessible/tabbable?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003c!--\n  \u003ca aria-label=\"Code coverage report\" href=\"https://codecov.io/gh/accessible-ui/tabbable\"\u003e\n    \u003cimg alt=\"Code coverage\" src=\"https://img.shields.io/codecov/c/gh/accessible-ui/tabbable?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  --\u003e\n  \u003ca aria-label=\"Build status\" href=\"https://travis-ci.org/accessible-ui/tabbable\"\u003e\n    \u003cimg alt=\"Build status\" src=\"https://img.shields.io/travis/accessible-ui/tabbable?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"NPM version\" href=\"https://www.npmjs.com/package/@accessible/tabbable\"\u003e\n    \u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/@accessible/tabbable?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n  \u003ca aria-label=\"License\" href=\"https://jaredlunde.mit-license.org/\"\u003e\n    \u003cimg alt=\"MIT License\" src=\"https://img.shields.io/npm/l/@accessible/tabbable?style=for-the-badge\u0026labelColor=24292e\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cpre align=\"center\"\u003enpm i @accessible/tabbable\u003c/pre\u003e\n\u003chr\u003e\n\nReturns an array of all\\* tabbable DOM nodes within a containing node. (\\* \"all\" has some necessary caveats, which you'll learn about by reading below.)\n\nThe following are considered tabbable:\n\n- `\u003cbutton\u003e`\n- `\u003cinput\u003e`\n- `\u003cselect\u003e`\n- `\u003ctextarea\u003e`\n- `\u003ca\u003e` with `href` or `xlink:href` attributes\n- `\u003caudio\u003e` and `\u003cvideos\u003e` with `controls` attributes\n- `[contenteditable]` elements\n- anything with a non-negative `tabindex`\n\nAny of the above will _not_ be considered tabbable, though, if any of the following are also true about it:\n\n- negative `tabindex`\n- `disabled`\n- either the node itself _or an ancestor of it_ is hidden via `display: none` or `visibility: hidden`\n- it's an `\u003cinput type=\"radio\"\u003e` and a different radio in its group is `checked`\n\n**If you think a node should be included in your array of tabbables _but it's not_, all you need to do is add `tabindex=\"0\"` to deliberately include it.** (Or if it is in your array but you don't want it, you can add `tabindex=\"-1\"` to deliberately exclude it.) This will also result in more consistent cross-browser behavior. For information about why your special node might _not_ be included, see [\"More details\"](#more-details), below.\n\n## API\n\n### `tabbable(rootNode: HTMLElement, includeRootNode: boolean = false): HTMLElement[]`\n\nReturns an array of ordered tabbable node within the `rootNode`.\n\nSummary of ordering principles:\n\n- First include any nodes with positive `tabindex` attributes (1 or higher), ordered by ascending `tabindex` and source order.\n- Then include any nodes with a zero `tabindex` and any element that by default receives focus (listed above) and does not have a positive `tabindex` set, in source order.\n\n## More details\n\n- **Tabbable tries to identify elements that are reliably tabbable across (not dead) browsers.** Browsers are stupidly inconsistent in their behavior, though — especially for edge-case elements like `\u003cobject\u003e` and `\u003ciframe\u003e` — so this means _some_ elements that you _can_ tab to in _some_ browsers will be left out of the results. (To learn more about that stupid inconsistency, see this [amazing table](https://allyjs.io/data-tables/focusable.html)). To provide better consistency across browsers and ensure the elements you _want_ in your tabbables list show up there, **try adding `tabindex=\"0\"` to edge-case elements that Tabbable ignores**.\n- (Exemplifying the above ^^:) **The tabbability of `\u003ciframe\u003e`, `\u003cembed\u003e`, `\u003cobject\u003e`, `\u003csummary\u003e`, and `\u003csvg\u003e` is [inconsistent across browsers](https://allyjs.io/data-tables/focusable.html)**, so if you need an accurate read on one of these elements you should try giving it a `tabindex`. (You'll also need to pay attention to the `focusable` attribute on SVGs in IE \u0026 Edge.) But you also might _not_ be able to get an accurate read — so you should avoid relying on it.\n- **Radio groups have some edge cases, which you can avoid by always having a `checked` one in each group** (and that is what you should usually do anyway). If there is no `checked` radio in the radio group, _all_ of the radios will be considered tabbable. (Some browsers do this, otherwise don't — there's not consistency.)\n- Although Tabbable tries to deal with positive tabindexes, **you should not use positive tabindexes**. Accessibility experts seem to be in (rare) unanimous and clear consent about this: rely on the order of elements in the document.\n- Safari on Mac OS X does not Tab to `\u003ca\u003e` elements by default: you have to change a setting to get the standard behavior. Tabbable does not know whether you've changed that setting or not, so it will include `\u003ca\u003e` elements in its list.\n\n## Why fork?\n\nThe creator is looking for a new maintainer and `@accessibile` packages don't need some of the features\nin the original, so I can make a smaller package with TypeScript types by forking :P\n\n## Credit\n\nThis library is forked from [tabbable](https://github.com/davidtheclark/tabbable)\n\n## LICENSE\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccessible-ui%2Ftabbable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faccessible-ui%2Ftabbable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faccessible-ui%2Ftabbable/lists"}