UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

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