wicg-focus-ring
Advanced tools
Comparing version 3.0.1 to 3.0.2
@@ -144,3 +144,8 @@ (function (global, factory) { | ||
function onWindowFocus() { | ||
window.removeEventListener('focus', onWindowFocus, true); | ||
// When removing the activeElement from DOM it's possible IE11 is in state | ||
// document.activeElement === null | ||
if (!document.activeElement) { | ||
return; | ||
} | ||
if (document.activeElement == elWithFocusRing) { | ||
@@ -163,4 +168,13 @@ addFocusRingClass(elWithFocusRing); | ||
window.addEventListener('focus', onWindowFocus, true); | ||
// When removing the activeElement from DOM it's possible IE11 is in state | ||
// document.activeElement === null | ||
if (!document.activeElement) { | ||
return; | ||
} | ||
// Set initial state back to assuming that the user is relying on the keyboard. | ||
// And add listeners to detect if they use a pointing device instead. | ||
hadKeyboardEvent = true; | ||
addInitialPointerMoveListeners(); | ||
if (document.activeElement.classList.contains('focus-ring')) { | ||
@@ -201,3 +215,5 @@ // Keep a reference to the element to which the focus-ring class is | ||
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯ | ||
if (e.target.nodeName.toLowerCase() === 'html') return; | ||
if (e.target.nodeName.toLowerCase() === 'html') { | ||
return; | ||
} | ||
@@ -204,0 +220,0 @@ hadKeyboardEvent = false; |
{ | ||
"name": "wicg-focus-ring", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "Polyfill for :focus-ring pseudo-selector", | ||
@@ -15,2 +15,3 @@ "scripts": { | ||
"lint-staged": { | ||
"src/focus-ring.js": ["eslint"], | ||
"*.{js,json,css}": ["prettier --write", "git add"] | ||
@@ -33,2 +34,5 @@ }, | ||
"concurrently": "3.5.0", | ||
"eslint": "4.11.0", | ||
"eslint-config-prettier": "2.7.0", | ||
"eslint-plugin-es5": "1.1.0", | ||
"expect": "1.20.2", | ||
@@ -43,3 +47,3 @@ "geckodriver": "1.10.0", | ||
"prettier": "1.8.2", | ||
"rollup": "0.51.6", | ||
"rollup": "0.51.7", | ||
"rollup-plugin-commonjs": "8.2.6", | ||
@@ -46,0 +50,0 @@ "rollup-plugin-node-resolve": "3.0.0", |
@@ -1,4 +0,1 @@ | ||
import resolve from 'rollup-plugin-node-resolve'; | ||
import commonjs from 'rollup-plugin-commonjs'; | ||
export default { | ||
@@ -9,4 +6,3 @@ input: 'src/focus-ring.js', | ||
format: 'umd' | ||
}, | ||
plugins: [resolve({ jsnext: true, main: true }), commonjs()] | ||
} | ||
}; |
@@ -138,3 +138,8 @@ /** | ||
function onWindowFocus() { | ||
window.removeEventListener('focus', onWindowFocus, true); | ||
// When removing the activeElement from DOM it's possible IE11 is in state | ||
// document.activeElement === null | ||
if (!document.activeElement) { | ||
return; | ||
} | ||
if (document.activeElement == elWithFocusRing) { | ||
@@ -157,4 +162,13 @@ addFocusRingClass(elWithFocusRing); | ||
window.addEventListener('focus', onWindowFocus, true); | ||
// When removing the activeElement from DOM it's possible IE11 is in state | ||
// document.activeElement === null | ||
if (!document.activeElement) { | ||
return; | ||
} | ||
// Set initial state back to assuming that the user is relying on the keyboard. | ||
// And add listeners to detect if they use a pointing device instead. | ||
hadKeyboardEvent = true; | ||
addInitialPointerMoveListeners(); | ||
if (document.activeElement.classList.contains('focus-ring')) { | ||
@@ -195,3 +209,5 @@ // Keep a reference to the element to which the focus-ring class is | ||
// window blurs, even if you're tabbing out of the page. ¯\_(ツ)_/¯ | ||
if (e.target.nodeName.toLowerCase() === 'html') return; | ||
if (e.target.nodeName.toLowerCase() === 'html') { | ||
return; | ||
} | ||
@@ -198,0 +214,0 @@ hadKeyboardEvent = false; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59800
59
1000
21