forked from WICG/inert
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
watch for [data-inert] elements and turn them inerted as well (WICG#126)
- Loading branch information
1 parent
a0c9c1a
commit 2368f0d
Showing
5 changed files
with
63 additions
and
36 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 |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
"code": 100, | ||
"tabWidth": 2, | ||
"ignoreUrls": true | ||
}] | ||
}], | ||
"linebreak-style": ["error", "windows"] | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,10 @@ | ||
<!-- | ||
This work is licensed under the W3C Software and Document License | ||
(http://www.w3.org/Consortium/Legal/2015/copyright-software-and-document). | ||
--> | ||
|
||
<div data-inert> | ||
<button>Click Me</button> | ||
<div id="fake-button" tabindex="0">Click me</div> | ||
</div> | ||
<button id="non-inert">Non-inert button</button> |
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,29 @@ | ||
describe('Data-Attribute', function() { | ||
before(function() { | ||
fixture.setBase('test/fixtures'); | ||
}); | ||
|
||
beforeEach(function(done) { | ||
fixture.load('data-attribute.html'); | ||
// Because inert relies on MutationObservers, | ||
// wait till next microtask before running tests. | ||
setTimeout(function() { | ||
done(); | ||
}, 0); | ||
}); | ||
|
||
afterEach(function() { | ||
fixture.cleanup(); | ||
}); | ||
|
||
it('should make implicitly focusable child not focusable', function() { | ||
var button = fixture.el.querySelector('[data-inert] button'); | ||
expect(isUnfocusable(button)).to.equal(true); | ||
}); | ||
|
||
it('should make explicitly focusable child not focusable', function() { | ||
var div = fixture.el.querySelector('#fake-button'); | ||
expect(div.hasAttribute('tabindex')).to.equal(false); | ||
expect(isUnfocusable(div)).to.equal(true); | ||
}); | ||
}); |