x4js 2.2.57 → 2.2.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/core/core_tools.ts +22 -9
package/package.json
CHANGED
package/src/core/core_tools.ts
CHANGED
|
@@ -982,18 +982,31 @@ export function setWaitCursor(wait: boolean) {
|
|
|
982
982
|
* return the focusable elements from a given node
|
|
983
983
|
*/
|
|
984
984
|
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
'button:not([tabindex="-1"]):not([disabled])',
|
|
985
|
+
const FOCUSABLE = [
|
|
986
|
+
'button:not([tabindex="-1"])',
|
|
988
987
|
'[href]',
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
988
|
+
'input',
|
|
989
|
+
'select',
|
|
990
|
+
'textarea',
|
|
992
991
|
'[tabindex]:not([tabindex="-1"])'
|
|
993
|
-
]
|
|
992
|
+
] .map( x => x+':not(:disabled):not([inert])' )
|
|
993
|
+
.join( ',' );
|
|
994
|
+
|
|
995
|
+
export function getFocusableElements(root: Element) {
|
|
996
|
+
const focusable = Array.from(root.querySelectorAll(FOCUSABLE));
|
|
994
997
|
|
|
995
|
-
|
|
996
|
-
|
|
998
|
+
return focusable.filter( x => {
|
|
999
|
+
// check visibility
|
|
1000
|
+
if( (x as HTMLElement).offsetParent == null ) {
|
|
1001
|
+
return false;
|
|
1002
|
+
}
|
|
1003
|
+
// check :inert | :disable
|
|
1004
|
+
if( x.closest('[inert]') || x.closest(":disabled") ) {
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
return true;
|
|
1009
|
+
});
|
|
997
1010
|
}
|
|
998
1011
|
|
|
999
1012
|
/**
|