{"name":"aria-hidden","version":"1.2.1","description":"Cast aria-hidden to everything, except...","main":"dist/es5/index.js","sideEffects":false,"scripts":{"test":"jest","dev":"lib-builder dev","test:ci":"jest --runInBand --coverage","build":"lib-builder build && yarn size:report","prepublish":"yarn build","release":"yarn build && yarn test","lint":"lib-builder lint","format":"lib-builder format","analyze":"ts-react-toolbox analyze","size":"npx size-limit","size:report":"npx size-limit --json > .size.json","update":"lib-builder update","prepublish-only":"yarn build && yarn changelog","prepare":"husky install","changelog":"conventional-changelog -p angular -i CHANGELOG.md -s","changelog:rewrite":"conventional-changelog -p angular -i CHANGELOG.md -s -r 0"},"author":{"name":"Anton Korzunov","email":"thekashey@gmail.com"},"license":"MIT","devDependencies":{"@theuiteam/lib-builder":"^0.2.1","@size-limit/preset-small-lib":"^2.1.6"},"engines":{"node":">=10"},"jsnext:main":"dist/es2015/index.js","module":"dist/es2015/index.js","types":"dist/es5/index.d.ts","keywords":["DOM","aria","hidden","inert"],"homepage":"https://github.com/theKashey/aria-hidden#readme","repository":{"type":"git","url":"git+https://github.com/theKashey/aria-hidden.git"},"dependencies":{"tslib":"^2.0.0"},"module:es2019":"dist/es2019/index.js","peerDependencies":{"react":"^16.9.0 || ^17.0.0 || ^18.0.0","@types/react":"^16.9.0 || ^17.0.0 || ^18.0.0"},"peerDependenciesMeta":{"@types/react":{"optional":true}},"lint-staged":{"*.{ts,tsx}":["prettier --write","eslint --fix"],"*.{js,css,json,md}":["prettier --write"]},"prettier":{"printWidth":120,"trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"gitHead":"1ab9eaea2bc97958ff6144c227f12eb96e51765e","bugs":{"url":"https://github.com/theKashey/aria-hidden/issues"},"_id":"aria-hidden@1.2.1","_nodeVersion":"16.15.1","_npmVersion":"8.11.0","dist":{"integrity":"sha512-PN344VAf9j1EAi+jyVHOJ8XidQdPVssGco39eNcsGdM4wcsILtxrKLkbuiMfLWYROK1FjRQasMWCBttrhjnr6A==","shasum":"ad8c1edbde360b454eb2bf717ea02da00bfee0f8","tarball":"http://registry-npm.ywwl.com/aria-hidden/download/aria-hidden-1.2.1.tgz","fileCount":9,"unpackedSize":27730,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeXcVkOUR2/2w7MwL6S+GHogDgUb168NjPAG/+fyMkPAIhAMeoNRJo17OG2LyfzSKvWUfXIeoQ7gQj2lQYhuEnxRuQ"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBDQ6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoR9g/9F1XcKkmrveksJw8RA3bwAhjQv6pVlywRXYiRsG+wwZpQM2c6\r\ngf9+YQ58vURQaxFgntUHF55OumqaFdmjpgkcPPM+MDvtQiMvAm5HwJMBFyIb\r\ndwEy6vKPuwgG04c0d1uffnEWkn0D4YR36L4WOkpFAk+2/i5jI5Zybn5gTWtm\r\nx4tx+TdM3ERAlEhbPKG09HwbXcRTM3YnPwYFlU8lXj8XEaNW85UwtXNXKula\r\n8gQ8+s+vsQT5Gfkvw+9DWi8smYD+l/+SMe2kw1o48b/h9kSg3meDK6wU85DI\r\n/K8wRIJ7uXX3rLbER6A7LiZyxae/L/4mXbOXewvD9r6KmvCoJLDBy5uumRNf\r\nV0sYV4d2fF8o37WVq6GYzD/qluwHPg4+6w4VJm2+vGnjaTqznbDCKamGo8JC\r\no9oMkrUcr/zElb8fdZ9apMGu47ElM+9WvzGiPng2afopNwHtX7NO/vmqBtNf\r\nkF5wSk3NeYA3K8LQESzfHPHuVorXZg2rCKjcDwve8cUQGB5CD0X2AhwTFFhk\r\nG5/uzyULtoAK6ABq+jZlw74zwmj8/Mj0RF1RowwOVhn2LQSb6+/XOQ5I7lyp\r\nfxiSgV1CDi3UNW0MzGaA24tRcpUcITtTA5HY56pX5puQtUaMKOtKZNecQzRy\r\nKqti+DYq0E/JG6gmXzFcFePyynpSUq15cB4=\r\n=qwOl\r\n-----END PGP SIGNATURE-----\r\n","size":4640,"noattachment":false,"key":"/aria-hidden/-/aria-hidden-1.2.1.tgz"},"_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"directories":{},"maintainers":[{"name":"kashey","email":"thekashey@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aria-hidden_1.2.1_1661219898690_0.9536655468714179"},"_hasShrinkwrap":false,"readme":"# aria-hidden\n\n[![NPM](https://nodei.co/npm/aria-hidden.png?downloads=true&stars=true)](https://nodei.co/npm/aria-hidden/)\n\nHides from ARIA everything, except provided node(s).\n\nHelps to isolate modal dialogs and focused task - the content will be not accessible using\naccessible tools.\n\nNow with [HTML inert](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert) support\n\n# API\n\nJust call `hideOthers` with DOM-node you want to keep, and it will _hide_ everything else.\n`targetNode` could be placed anywhere - its siblings would be hidden, but it and its parents - not.\n\n> \"hidden\" in terms or `aria-hidden`\n\n```js\nimport { hideOthers } from 'aria-hidden';\n\nconst undo = hideOthers(exceptThisDOMnode);\n// everything else is \"aria-hidden\"\n\n// undo changes\nundo();\n```\n\nyou also may limit the effect spread by providing top level node as a second parameter\n\n```js\n// keep only `anotherNode` node visible in #app\n// the rest of document will be untouched\nhideOthers(anotherNode, document.getElementById('app'));\n```\n\n> `parentNode` defaults to document.body\n\n# Inert\n\nWhile `aria-hidden` played important role in the past and will play in the future - the main\nuse case always was around isolating content and making elements \"transparent\" not only for aria, but for\nuser interaction as well.\n\nThis is why you might consider using `inertOthers`\n\n```tsx\nimport { hideOthers, inertOthers, supportsInert } from 'aria-hidden';\n\n// focus on element mean \"hide others\". Ideally disable interactions\nconst focusOnElement = (node) => (supportsInert() ? inertOthers(node) : hideOthers(node));\n```\n\nthe same function as above is already contructed and exported as\n\n```tsx\nimport { suppressOthers } from 'aria-hidden';\n\nsuppressOthers([keepThisNode, andThis]);\n```\n\n⚠️ Note - inert **will disable any interactions** with _suppressed_ elements ⚠️\n\n### Suppressing interactivity without inert\n\nOne can `marker`, the third argument to a function, to mark hidden elements.\nLater one can create a style matching given marker to apply `pointer-events:none`\n\n```css\n[hidden-node] {\n  pointer-events: none;\n}\n```\n\n```tsx\nhideOthers(notThisOne, undefined /*parent = document*/, 'hidden-node');\n```\n\nGenerally speaking the same can be achieved by addressing `[aria-hidden]` nodes, but\nnot all `aria-hidden` nodes are expected to be non-interactive.\nHence, it's better to separate concerns.\n\n# Inspiration\n\nBased on [smooth-ui](https://github.com/smooth-code/smooth-ui) modal dialogs.\n\n# See also\n\n- [inert](https://github.com/WICG/inert) - The HTML attribute/property to mark parts of the DOM tree as \"inert\".\n- [react-focus-lock](https://github.com/theKashey/react-focus-lock) to lock Focus inside modal.\n- [react-scroll-lock](https://github.com/theKashey/react-scroll-lock) to disable page scroll while modal is opened.\n\n# Size\n\nCode is 30 lines long\n\n# Licence\n\nMIT\n","publish_time":1661219898886,"_cnpm_publish_time":1661219898886,"dist-tags":{"latest":"1.2.6"}}