- Updated all component headers and documentation
- Changed navbar and footer branding
- Updated homepage hero badge
- Modified page title in index.html
- Simplified footer text to 'Built with ❤️'
- Consistent V2 capitalization across all references
21 lines
792 B
JavaScript
21 lines
792 B
JavaScript
import { FOCUS_ALLOW } from './constants';
|
|
import { contains } from './utils/DOMutils';
|
|
import { toArray } from './utils/array';
|
|
import { getActiveElement } from './utils/getActiveElement';
|
|
/**
|
|
* checks if focus is hidden FROM the focus-lock
|
|
* ie contained inside a node focus-lock shall ignore
|
|
*
|
|
* This is a utility function coupled with {@link FOCUS_ALLOW} constant
|
|
*
|
|
* @returns {boolean} focus is currently is in "allow" area
|
|
*/
|
|
export const focusIsHidden = (inDocument = document) => {
|
|
const activeElement = getActiveElement(inDocument);
|
|
if (!activeElement) {
|
|
return false;
|
|
}
|
|
// this does not support setting FOCUS_ALLOW within shadow dom
|
|
return toArray(inDocument.querySelectorAll(`[${FOCUS_ALLOW}]`)).some((node) => contains(node, activeElement));
|
|
};
|