UNPKG

@wordpress/components

Version:
8 lines (7 loc) 1.61 kB
{ "version": 3, "sources": ["../../../src/higher-order/with-constrained-tabbing/index.tsx"], "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { createHigherOrderComponent, useConstrainedTabbing } from '@wordpress/compose';\n\n/**\n * `withConstrainedTabbing` is a React [higher-order component](https://facebook.github.io/react/docs/higher-order-components.html)\n * adding the ability to constrain keyboard navigation with the Tab key within a component.\n * For accessibility reasons, some UI components need to constrain Tab navigation, for example\n * modal dialogs or similar UI. Use of this component is recommended only in cases where a way to\n * navigate away from the wrapped component is implemented by other means, usually by pressing\n * the Escape key or using a specific UI control, e.g. a \"Close\" button.\n */\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst withConstrainedTabbing = createHigherOrderComponent(WrappedComponent => function ComponentWithConstrainedTabbing(props) {\n const ref = useConstrainedTabbing();\n return /*#__PURE__*/_jsx(\"div\", {\n ref: ref,\n tabIndex: -1,\n children: /*#__PURE__*/_jsx(WrappedComponent, {\n ...props\n })\n });\n}, 'withConstrainedTabbing');\nexport default withConstrainedTabbing;"], "mappings": ";AAGA,SAAS,4BAA4B,6BAA6B;AAUlE,SAAS,OAAO,YAAY;AAC5B,IAAM,yBAAyB,2BAA2B,sBAAoB,SAAS,gCAAgC,OAAO;AAC5H,QAAM,MAAM,sBAAsB;AAClC,SAAoB,qBAAK,OAAO;AAAA,IAC9B;AAAA,IACA,UAAU;AAAA,IACV,UAAuB,qBAAK,kBAAkB;AAAA,MAC5C,GAAG;AAAA,IACL,CAAC;AAAA,EACH,CAAC;AACH,GAAG,wBAAwB;AAC3B,IAAO,mCAAQ;", "names": [] }