UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

18 lines (16 loc) • 714 B
export const isShortcutToFocusToolbar = event => { return event.altKey && event.key === 'F10'; }; export const getFocusableElements = rootNode => { if (!rootNode) { return []; } const focusableElements = rootNode.querySelectorAll('a[href], button:not([disabled]), textarea, input, select, div[tabindex="-1"], div[tabindex="0"]') || []; const focusableElementsArray = Array.from(focusableElements); // filter out focusable elements from child components such as dropdown menus / popups return focusableElementsArray.filter(elm => { const style = window.getComputedStyle(elm); // filter out invisible elements return style.visibility !== 'hidden' && style.display !== 'none'; }); };