UNPKG

@react-md/menu

Version:

Create menus that auto-position themselves within the viewport and adhere to the accessibility guidelines

27 lines 1.33 kB
"use strict"; var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.MenuKeyboardFocusProvider = void 0; var jsx_runtime_1 = require("react/jsx-runtime"); var utils_1 = require("@react-md/utils"); /** @remarks \@since 5.0.0 */ function MenuKeyboardFocusProvider(_a) { var _b = _a.horizontal, horizontal = _b === void 0 ? false : _b, children = _a.children; return ((0, jsx_runtime_1.jsx)(utils_1.KeyboardMovementProvider, __assign({ loopable: true, searchable: true, incrementKeys: horizontal ? ["ArrowRight"] : ["ArrowDown"], decrementKeys: horizontal ? ["ArrowLeft"] : ["ArrowUp"], // disabled menu items should be focusable, but not interactable for some // reason // https://www.w3.org/TR/wai-aria-practices/#menu includeDisabled: true }, { children: children }))); } exports.MenuKeyboardFocusProvider = MenuKeyboardFocusProvider; //# sourceMappingURL=MenuKeyboardFocusProvider.js.map