@wordpress/dom
Advanced tools
Comparing version 3.23.0 to 3.24.0
@@ -169,13 +169,7 @@ /** | ||
export function findPrevious(element) { | ||
const focusables = findFocusable(element.ownerDocument.body); | ||
const index = focusables.indexOf(element); | ||
if (index === -1) { | ||
return undefined; | ||
} // Remove all focusables after and including `element`. | ||
focusables.length = index; | ||
const tabbable = filterTabbable(focusables); | ||
return tabbable[tabbable.length - 1]; | ||
return filterTabbable(findFocusable(element.ownerDocument.body)).reverse().find(focusable => { | ||
return (// eslint-disable-next-line no-bitwise | ||
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING | ||
); | ||
}); | ||
} | ||
@@ -192,8 +186,8 @@ /** | ||
export function findNext(element) { | ||
const focusables = findFocusable(element.ownerDocument.body); | ||
const index = focusables.indexOf(element); // Remove all focusables before and including `element`. | ||
const remaining = focusables.slice(index + 1); | ||
return filterTabbable(remaining)[0]; | ||
return filterTabbable(findFocusable(element.ownerDocument.body)).find(focusable => { | ||
return (// eslint-disable-next-line no-bitwise | ||
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING | ||
); | ||
}); | ||
} | ||
//# sourceMappingURL=tabbable.js.map |
@@ -182,13 +182,7 @@ "use strict"; | ||
function findPrevious(element) { | ||
const focusables = (0, _focusable.find)(element.ownerDocument.body); | ||
const index = focusables.indexOf(element); | ||
if (index === -1) { | ||
return undefined; | ||
} // Remove all focusables after and including `element`. | ||
focusables.length = index; | ||
const tabbable = filterTabbable(focusables); | ||
return tabbable[tabbable.length - 1]; | ||
return filterTabbable((0, _focusable.find)(element.ownerDocument.body)).reverse().find(focusable => { | ||
return (// eslint-disable-next-line no-bitwise | ||
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_PRECEDING | ||
); | ||
}); | ||
} | ||
@@ -206,8 +200,8 @@ /** | ||
function findNext(element) { | ||
const focusables = (0, _focusable.find)(element.ownerDocument.body); | ||
const index = focusables.indexOf(element); // Remove all focusables before and including `element`. | ||
const remaining = focusables.slice(index + 1); | ||
return filterTabbable(remaining)[0]; | ||
return filterTabbable((0, _focusable.find)(element.ownerDocument.body)).find(focusable => { | ||
return (// eslint-disable-next-line no-bitwise | ||
element.compareDocumentPosition(focusable) & element.DOCUMENT_POSITION_FOLLOWING | ||
); | ||
}); | ||
} | ||
//# sourceMappingURL=tabbable.js.map |
@@ -5,2 +5,4 @@ <!-- Learn how to maintain this file at https://github.com/WordPress/gutenberg/tree/HEAD/packages#maintaining-changelogs. --> | ||
## 3.24.0 (2023-01-02) | ||
## 3.23.0 (2022-12-14) | ||
@@ -7,0 +9,0 @@ |
{ | ||
"name": "@wordpress/dom", | ||
"version": "3.23.0", | ||
"version": "3.24.0", | ||
"description": "DOM utilities module for WordPress.", | ||
@@ -32,3 +32,3 @@ "author": "The WordPress Contributors", | ||
"@babel/runtime": "^7.16.0", | ||
"@wordpress/deprecated": "^3.23.0" | ||
"@wordpress/deprecated": "^3.24.0" | ||
}, | ||
@@ -38,3 +38,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848" | ||
"gitHead": "200bee7b06b15f6fa655e25b6ab69cbd6b49a357" | ||
} |
@@ -162,14 +162,11 @@ /** | ||
export function findPrevious( element ) { | ||
const focusables = findFocusable( element.ownerDocument.body ); | ||
const index = focusables.indexOf( element ); | ||
if ( index === -1 ) { | ||
return undefined; | ||
} | ||
// Remove all focusables after and including `element`. | ||
focusables.length = index; | ||
const tabbable = filterTabbable( focusables ); | ||
return tabbable[ tabbable.length - 1 ]; | ||
return filterTabbable( findFocusable( element.ownerDocument.body ) ) | ||
.reverse() | ||
.find( ( focusable ) => { | ||
return ( | ||
// eslint-disable-next-line no-bitwise | ||
element.compareDocumentPosition( focusable ) & | ||
element.DOCUMENT_POSITION_PRECEDING | ||
); | ||
} ); | ||
} | ||
@@ -186,9 +183,11 @@ | ||
export function findNext( element ) { | ||
const focusables = findFocusable( element.ownerDocument.body ); | ||
const index = focusables.indexOf( element ); | ||
// Remove all focusables before and including `element`. | ||
const remaining = focusables.slice( index + 1 ); | ||
return filterTabbable( remaining )[ 0 ]; | ||
return filterTabbable( findFocusable( element.ownerDocument.body ) ).find( | ||
( focusable ) => { | ||
return ( | ||
// eslint-disable-next-line no-bitwise | ||
element.compareDocumentPosition( focusable ) & | ||
element.DOCUMENT_POSITION_FOLLOWING | ||
); | ||
} | ||
); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
531495