File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -89,10 +89,16 @@ const getFocusables = (scope) => {
8989 * @param {HTMLElement } scope The element to search inside of
9090 * @return {HTMLElement[] } Array of valid focusables inside the scope
9191 */
92- const getAllFocusables = ( scope ) => [
93- ...toArray ( scope . querySelectorAll ( focusableContainerSelector ) ) . filter ( container => getFocusables ( container ) ?. length > 0 ) ,
94- ...getFocusables ( scope )
95- ] ;
92+ const getAllFocusables = ( scope ) => {
93+ const ignoredElements = toArray ( scope . querySelectorAll ( ignoreSelector ) ) ;
94+
95+ return [
96+ ...toArray ( scope . querySelectorAll ( focusableContainerSelector ) )
97+ . filter ( node => ! ignoredElements . some ( ignored => ignored == node || ignored . contains ( node ) ) )
98+ . filter ( container => getFocusables ( container ) ?. length > 0 ) ,
99+ ...getFocusables ( scope )
100+ ] ;
101+ } ;
96102
97103/**
98104 * Build an array of ancestor containers
You can’t perform that action at this time.
0 commit comments