@wordpress/dom
Advanced tools
Comparing version 2.12.0 to 2.13.0
@@ -33,2 +33,15 @@ /** | ||
/** | ||
* Returns true if the specified element should be skipped from focusable elements. | ||
* For now it rather specific for `iframes` and if tabindex attribute is set to -1. | ||
* | ||
* @param {Element} element DOM element to test. | ||
* | ||
* @return {boolean} Whether element should be skipped from focusable elements. | ||
*/ | ||
function skipFocus(element) { | ||
return element.nodeName.toLowerCase() === 'iframe' && element.getAttribute('tabindex') === '-1'; | ||
} | ||
/** | ||
* Returns true if the specified area element is a valid focusable element, or | ||
@@ -66,3 +79,3 @@ * false otherwise. Area is only focusable if within a map where a named map | ||
return Array.from(elements).filter(function (element) { | ||
if (!isVisible(element)) { | ||
if (!isVisible(element) || skipFocus(element)) { | ||
return false; | ||
@@ -69,0 +82,0 @@ } |
@@ -40,2 +40,15 @@ "use strict"; | ||
/** | ||
* Returns true if the specified element should be skipped from focusable elements. | ||
* For now it rather specific for `iframes` and if tabindex attribute is set to -1. | ||
* | ||
* @param {Element} element DOM element to test. | ||
* | ||
* @return {boolean} Whether element should be skipped from focusable elements. | ||
*/ | ||
function skipFocus(element) { | ||
return element.nodeName.toLowerCase() === 'iframe' && element.getAttribute('tabindex') === '-1'; | ||
} | ||
/** | ||
* Returns true if the specified area element is a valid focusable element, or | ||
@@ -73,3 +86,3 @@ * false otherwise. Area is only focusable if within a map where a named map | ||
return Array.from(elements).filter(function (element) { | ||
if (!isVisible(element)) { | ||
if (!isVisible(element) || skipFocus(element)) { | ||
return false; | ||
@@ -76,0 +89,0 @@ } |
{ | ||
"name": "@wordpress/dom", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "DOM utilities module for WordPress.", | ||
@@ -33,3 +33,3 @@ "author": "The WordPress Contributors", | ||
}, | ||
"gitHead": "8e06f0d212f89adba9099106497117819adefc5a" | ||
"gitHead": "381a42b62e157d0e7fd6366cc51b0f5725990044" | ||
} |
@@ -51,2 +51,17 @@ /** | ||
/** | ||
* Returns true if the specified element should be skipped from focusable elements. | ||
* For now it rather specific for `iframes` and if tabindex attribute is set to -1. | ||
* | ||
* @param {Element} element DOM element to test. | ||
* | ||
* @return {boolean} Whether element should be skipped from focusable elements. | ||
*/ | ||
function skipFocus( element ) { | ||
return ( | ||
element.nodeName.toLowerCase() === 'iframe' && | ||
element.getAttribute( 'tabindex' ) === '-1' | ||
); | ||
} | ||
/** | ||
* Returns true if the specified area element is a valid focusable element, or | ||
@@ -81,3 +96,3 @@ * false otherwise. Area is only focusable if within a map where a named map | ||
return Array.from( elements ).filter( ( element ) => { | ||
if ( ! isVisible( element ) ) { | ||
if ( ! isVisible( element ) || skipFocus( element ) ) { | ||
return false; | ||
@@ -84,0 +99,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
244389
3124