UNPKG

@atlaskit/editor-plugin-toolbar

Version:

Toolbar plugin for @atlaskit/editor-core

24 lines (21 loc) • 978 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isShortcutToFocusToolbar = exports.getFocusableElements = void 0; var isShortcutToFocusToolbar = exports.isShortcutToFocusToolbar = function isShortcutToFocusToolbar(event) { return event.altKey && event.key === 'F10'; }; var getFocusableElements = exports.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'; }); };