-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new getTabIndex() export (#1039)
This is needed for focus-trap/focus-trap#974 which will add support for positive tabindexes in focus-trap. Also updates the docs/typings to make them more consistent and fix some broken links.
- Loading branch information
1 parent
66b753b
commit 18a093f
Showing
8 changed files
with
175 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'tabbable': minor | ||
--- | ||
|
||
Add new `getTabIndex()` API which enables Focus-trap to determine tab indexes in the same way as Tabbable when necessary (see [focus-trap#974](https://github.com/focus-trap/focus-trap/pull/974)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<a id="anchor-tabindex-none" href="#">no tabindex</a> | ||
<button id="btn-tabindex-1" tabindex="1">tabindex=1</button> | ||
|
||
<div id="contenteditable-tabindex-none" contenteditable="true" style="padding:1em"> | ||
editable text, no tabindex | ||
</div> | ||
<div id="contenteditable-tabindex-neg" contenteditable="true" style="padding:1em" tabindex="-1"> | ||
editable text, neg tabindex | ||
</div> | ||
|
||
<audio id="audio-control-tabindex-none" controls></audio> | ||
<audio id="audio-nocontrol-tabindex-none"></audio> | ||
<audio id="audio-control-tabindex-invalid" tabindex="foo" controls></audio> | ||
<audio id="audio-control-tabindex-2" tabindex="2" controls></audio> | ||
|
||
<video id="video-control-tabindex-none" controls></video> | ||
<video id="video-nocontrol-tabindex-none"></video> | ||
<video id="video-control-tabindex-invalid" tabindex="bar" controls></video> | ||
<video id="video-control-tabindex-3" tabindex="3" controls></video> | ||
|
||
<details id="details-tabindex-none"> | ||
<summary>details tabindex-none title</summary> | ||
details tabindex-none content | ||
</details> | ||
<details id="details-tabindex-neg" tabindex="-1"> | ||
<summary>details tabindex-neg title</summary> | ||
details tabindex-neg content | ||
</details> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
const { isFocusable, isTabbable } = require('../../src/index.js'); | ||
const { isFocusable, isTabbable, getTabIndex } = require('../../src/index.js'); | ||
|
||
describe('tabbable unit tests', () => { | ||
it('should throw with no input node', () => { | ||
expect(() => isFocusable()).toThrow(); | ||
expect(() => isTabbable()).toThrow(); | ||
expect(() => getTabIndex()).toThrow(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters