{"name":"aria-hidden","version":"1.0.0","description":"Cast aria-hidden to everything, except...","main":"dist/es5/index.js","scripts":{"test":"ts-react-toolbox test","bootstrap":"ts-react-toolbox init","dev":"ts-react-toolbox dev","test:ci":"ts-react-toolbox test --runInBand --coverage","build":"ts-react-toolbox build","release":"ts-react-toolbox release","lint":"ts-react-toolbox lint","static":"ts-react-toolbox publish","format":"ts-react-toolbox format","analyze":"ts-react-toolbox analyze"},"author":{"name":"Anton Korzunov","email":"thekashey@gmail.com"},"license":"ISC","devDependencies":{"ts-react-toolbox":"^0.1.22"},"engines":{"node":">=8.5.0"},"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"},"gitHead":"b5538c70316f7d2f857272196230e9e155e1e4ee","bugs":{"url":"https://github.com/theKashey/aria-hidden/issues"},"_id":"aria-hidden@1.0.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"kashey","email":"thekashey@gmail.com"},"dist":{"integrity":"sha512-ymrp2YffmX+JYZpMONvl15nwlDoCHh9JCyxLFZrY76WAzMFcHC/NKatgdY1yMUhC0rwMtJDEXoyUrDQsTPULhA==","shasum":"cdaa340a5b59cf418d345b802e08f0bbb65472d1","tarball":"http://registry-npm.ywwl.com/aria-hidden/download/aria-hidden-1.0.0.tgz","fileCount":6,"unpackedSize":4636,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbzsQcCRA9TVsSAnZWagAAWQcP/2BPUFtfKCulU5AUbf4O\n6w20r4Kvi9Qvmpf+bIS6URzOi9v8se9wfHJDPGHBCutEwYH/LWTRjp1s4VDq\n4DwOqgIWXgsnSvJ/6b1MWbi/m6Yl3pY+hhw0m/b4Iobhi0Z2Khj+uJFqub8s\neWvxUQ3ChdX+pSSZxdYgSxe0aXcXc5VMQg5Awq860HJPP0T8QTHZ5vqEcd9Q\nq/w7hgTgmIxRupkNbGKbH9YiQsDcze1uDMIk/aAnc+fZrGtI13mVe+te0Ymk\nimK5sF1FzNfTNSdYv1qdJ+eOwRFug7JtF2zYMG0Ymhu/lB/ogswChYvgcmPt\nPqrTpnNWDmPObc+pTr2QzCapANEC00bNGaBXDop7Y5KE/yQxMr9UslRTMT+l\nowCLY3+DA7J2fWpVpky8q5o0UX+h8bj2bttlh6v0t+Q/ZqbRZv+o1AgqtBiy\nrpiqkH/Emx4zsvEVSYYA5CTt6jMUUCwRcczfAQ3drbaX8AK8vBqeobHzjHGm\nGNM9XNjHzs7OKSTpZlkThRZruEd5Z1+1HVwST51GL1/j4r9RiMcuoiuvVfRO\nhfg4vWUkbTA/ozYuV+95csFmoQ8hhcMDw8Ii1zVqVYh0uEIYWDN2UzPtCc0J\n/NDyR2MBzHfPoepTqQKTQ/ziT2QeWZS/LTIVW/UukU9JN6eQu5DaMZz4Kaqd\nFn0x\r\n=jLGg\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCflIg4MLPLil9Y+8/8CcXJHmb3rT6/Ns6Z7ZQ7xOPVjgIhAKrrQx4nBjj4IQii2QmthbLtGmAsERwN5gwr/uwN2EVD"}],"size":1621,"noattachment":false,"key":"/aria-hidden/-/aria-hidden-1.0.0.tgz"},"maintainers":[{"name":"kashey","email":"thekashey@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aria-hidden_1.0.0_1540277276095_0.9408352860924141"},"_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":1540277276285,"_cnpm_publish_time":1540277276285,"dist-tags":{"latest":"1.2.6"}}