Skip to content

Commit

Permalink
fix: tabIndex=-1 elements should be autofocusable if pointed, fixes #108
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Jun 18, 2020
1 parent 25082e5 commit 258e6aa
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
15 changes: 14 additions & 1 deletion _tests/FocusLock.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,23 @@ text
expect(document.activeElement.innerHTML).to.be.equal('action');
});

it('MoveFocusInside works with non-tabbable elements', () => {
mount(<FocusLock>
<MoveFocusInside>
<div>
text
<button tabIndex={-1}>action</button>
text
</div>
</MoveFocusInside>
</FocusLock>);
expect(document.activeElement.innerHTML).to.be.equal('action');
});

it('FocusLock do nothing', () => {
mount(<FocusLock autoFocus={false}>
<div>
text
text
<button>action</button>
text
</div>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"homepage": "https://github.com/theKashey/react-focus-lock#readme",
"dependencies": {
"@babel/runtime": "^7.0.0",
"focus-lock": "^0.6.7",
"focus-lock": "^0.7.0",
"prop-types": "^15.6.2",
"react-clientside-effect": "^1.2.2",
"use-callback-ref": "^1.2.1",
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5377,6 +5377,11 @@ focus-lock@^0.6.7:
resolved "https://registry.yarnpkg.com/focus-lock/-/focus-lock-0.6.8.tgz#61985fadfa92f02f2ee1d90bc738efaf7f3c9f46"
integrity sha512-vkHTluRCoq9FcsrldC0ulQHiyBYgVJB2CX53I8r0nTC6KnEij7Of0jpBspjt3/CuNb6fyoj3aOh9J2HgQUM0og==

focus-lock@^0.7.0:
version "0.7.0"
resolved "https://registry.yarnpkg.com/focus-lock/-/focus-lock-0.7.0.tgz#b2bfb0ca7beacc8710a1ff74275fe0dc60a1d88a"
integrity sha512-LI7v2mH02R55SekHYdv9pRHR9RajVNyIJ2N5IEkWbg7FT5ZmJ9Hw4mWxHeEUcd+dJo0QmzztHvDvWcc7prVFsw==

for-in@^0.1.3:
version "0.1.8"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"
Expand Down

0 comments on commit 258e6aa

Please sign in to comment.