@react-md/menu
Version:
Create menus that auto-position themselves within the viewport and adhere to the accessibility guidelines
23 lines • 1.14 kB
JavaScript
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);
};
import { jsx as _jsx } from "react/jsx-runtime";
import { KeyboardMovementProvider } from "@react-md/utils";
/** @remarks \@since 5.0.0 */
export function MenuKeyboardFocusProvider(_a) {
var _b = _a.horizontal, horizontal = _b === void 0 ? false : _b, children = _a.children;
return (_jsx(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 })));
}
//# sourceMappingURL=MenuKeyboardFocusProvider.js.map