Skip to content

Commit

Permalink
Add test for :focus-visible and fix wrong references in :focus-within (
Browse files Browse the repository at this point in the history
…Modernizr#2665)

* Create focusvisible.js

* Fix wrong reference to CSS focus-within feature

* Fix wrong reference for CSS focus-within feature

* Add css-focus-visible to caniuse integration tests

* Include focusvisible in config-all.json

* Add authors tag to focusvisible.js
  • Loading branch information
esaborit4code authored Oct 14, 2021
1 parent 049b6ca commit a8a24bf
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
19 changes: 19 additions & 0 deletions feature-detects/css/focusvisible.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*!
{
"name": "CSS :focus-visible pseudo-selector",
"caniuse": "css-focus-visible",
"property": "focusvisible",
"authors": ["@esaborit4code"],
"tags": ["css"]
}
!*/
define(['Modernizr'], function(Modernizr) {
Modernizr.addTest('focusvisible', function() {
try {
document.querySelector(':focus-visible');
} catch (error) {
return false;
}
return true;
});
});
2 changes: 1 addition & 1 deletion feature-detects/css/focuswithin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
{
"name": "CSS :focus-within pseudo-selector",
"caniuse": "css-focus-visible",
"caniuse": "css-focus-within",
"property": "focuswithin",
"tags": ["css"]
}
Expand Down
1 change: 1 addition & 0 deletions lib/config-all.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"css/flexboxtweener",
"css/flexgap",
"css/flexwrap",
"css/focusvisible",
"css/focuswithin",
"css/fontdisplay",
"css/fontface",
Expand Down
3 changes: 2 additions & 1 deletion test/browser/integration/caniuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ window.caniusecb = function(caniuse) {
flexbox: 'flexbox',
flexboxlegacy: 'flexbox',
flexboxtweener: 'flexbox',
focuswithin: 'css-focus-visible',
focusvisible: 'css-focus-visible',
focuswithin: 'css-focus-within',
fontdisplay: 'css-font-rendering-controls',
fontface: 'fontface',
formvalidationapi: 'form-validation',
Expand Down

0 comments on commit a8a24bf

Please sign in to comment.