{"name":"aria-hidden","version":"1.2.3","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","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","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":"71bf8c918626d7aad2acff058bd08efecaeb7060","bugs":{"url":"https://github.com/theKashey/aria-hidden/issues"},"_id":"aria-hidden@1.2.3","_nodeVersion":"16.15.0","_npmVersion":"8.5.5","dist":{"integrity":"sha512-xcLxITLe2HYa1cnYnwCjkOO1PqUHQpozB8x9AR0OgWN2woOBi5kSDVxKfd0b7sb1hw5qFeJhXm9H1nu3xSfLeQ==","shasum":"14aeb7fb692bbb72d69bebfa47279c1fd725e954","tarball":"http://registry-npm.ywwl.com/aria-hidden/download/aria-hidden-1.2.3.tgz","fileCount":9,"unpackedSize":29954,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFPctgqvcW2qp8/bhwPtfpx1oAq44ne3K9bV6fpHFEsRAiEAy8OMO5LMl3pNli9JUFs52tbjAYhVnsg/+evsiA00cVk="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAtOrACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmolYA/9EHKWSnNaFHBW3gKS18RGbrmvvYSDpBgD/uBy2Tqxll7Ercik\r\noqMmZEgAeqLYv+n7I1aS6hApjTCc/k2mrcq1FagAM9lVrbKUSsWuwL53uu1b\r\n95rl4aIY5LiooXhqh6wOimci6mWg8I7zOoCaIgFOXmVXABpDnCrJs4ClkST6\r\nl9Oh+htuhdWCzQ7RWcGCBrfMDEQSSOwVo6nKa2DGFcqbGfr47Kq7BO064TjR\r\nXtBf7D774qKlLOTZU+31f/nLDv5YNKH2/INeeF2WWhnz0JdLh/fYgx7N+QNi\r\nSSIV4BxtLeoahm+voum6SupwYbNo/tAsSPAVOH073NKdNnY1Ffg3395lyn4v\r\nPoS+DDUu+4DReIUEMiZGkK8exLBddDrAQh1S1MBZbF5/vCdSqtzUuRz+WpiR\r\n6ockyZENWKDLBgLdoDjlBL50ZuMdqLLKH+N2qOaRXNGPakdnbIUJxj2wTOTL\r\nyzM1yw/sHItO79lcRxPrZnDixLzPbZQVQKcD8AuKafjqYpHxVUedrLZBZ40/\r\ndRqGqHxNZOoWlqlQd3e3NOt0UfOQZXl1NSF8n+AGdjWo5Rrm6u3cwuGyCZwG\r\n029Vv4nx18gBgEPdaa7K+YU8wvlBAmhBsmQxopn74yIscTe4p3GatgiXc9ro\r\n8mcODSt9AUDv50abrU8bcHOAi8mnPJM8L04=\r\n=cfw+\r\n-----END PGP SIGNATURE-----\r\n","size":5109,"noattachment":false,"key":"/aria-hidden/-/aria-hidden-1.2.3.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.3_1677906859410_0.15281647845294533"},"_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":1677906859581,"_cnpm_publish_time":1677906859581,"dist-tags":{"latest":"1.2.6"}}