{"_id":"@daniel.husar/focus-trap","_rev":"4-5027c4a40a31c64bc9f9b650778267a7","name":"@daniel.husar/focus-trap","dist-tags":{"latest":"1.0.3"},"versions":{"1.0.0":{"name":"@daniel.husar/focus-trap","version":"1.0.0","description":"Add focus traps to the elements","scripts":{"test":"yarn lint && yarn test","unit":"jest","lint":"flow --quiet","build":"babel src/index.js --out-file dest/index.js","prepublish":"yarn build"},"main":"dest/index.js","author":{"name":"Daniel Husar"},"repository":{"type":"git","url":"git+https://github.com/danielhusar/focus-trap.git"},"keywords":["focus","trap","focus-trap","accesibility","a11y"],"license":"MIT","private":false,"devDependencies":{"@babel/cli":"^7.1.5","@babel/core":"^7.1.5","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/preset-env":"^7.1.5","@babel/preset-flow":"^7.0.0","babel-core":"^7.0.0-bridge","babel-jest":"^23.6.0","flow-bin":"^0.85.0","jest":"^23.6.0","prettier":"1.14.2"},"bugs":{"url":"https://github.com/danielhusar/focus-trap/issues"},"homepage":"https://github.com/danielhusar/focus-trap#readme","gitHead":"f8dfe62e6d4298b0afd463006f33d5757af6d305","_id":"@daniel.husar/focus-trap@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"efrafa","email":"dano.husar@gmail.com"},"dist":{"integrity":"sha512-HE1ow5bmCs/YU1i7umb2U0EVb0O3t7RsbRLRjyoVN3kiHKRvm+Q8OMFteAe3d5aUGHxDSnXyHWsi0q7tw6HQOw==","shasum":"8d99381ac753ea5e6a6841e639c42dd701970bc6","tarball":"https://registry.npmjs.org/@daniel.husar/focus-trap/-/focus-trap-1.0.0.tgz","fileCount":3,"unpackedSize":6934,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5NKOCRA9TVsSAnZWagAAJ5YQAJ+hTXXhs7IsILJ/REkQ\n4GKKySU2vwsG3kYKpWfqPJp+D9ag8dbA0T8RvDsG599W6wW0JCZ8nNdW9mid\nuNemGWIaMa8vN0Mwfhrhl8of0m7A/53emNzuWKvMqz5nN7aGWl1NeUxhaTgs\nbRy/1oqeJaMpnmhkrmqA4W2AT2a0slPQt8LepsrUFrj1Kz0LDOSwcu80I+to\ngzrl5b/IioHNRvRbpT+TBoKbEHnlOx1Qgh+3+XZtu6jNDnchkiyixmj0BvYf\nwyKVGn3Pux2VDDhUFbODRsm9o1rUVkwveYHaCbCjWtr/c08xCRjAa5fUMIrF\n1WarrrfWKFB40LX8IgWuewI3ajeVKgGcO9nYEPmSj+XgAM5Bp4YEd1pEWNJe\nEUyXM+1Ieh+Z6briD1ZIrn0gdER3WdR30uD33/X2eZ/CufxwcEUVzjlHGPs8\nYE9YiMxuM6FpD6j/KKo19m56N2QNoBAYJabcBR9HTbTxc70fL45tqBtlLVxa\nAao5e1eI4h2u7jT/cL79bPGuTBn4hmaavfFzuXRQl7qyJuYpCm9K9Lfv9SB0\nrgd5JKeMSB6V6DT88+Q7qPCR8EwVAr+eI5A1Khz5RjwXZVxuUXqbP3fMCJ7f\nS0zvc3Bc4BD3fov1k04Qiz0Y/eyoRpnV1x4/7o11cyYyeGsM+uMNHhwcU+tU\nXJ3z\r\n=00HR\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFtdRT+pPqm4OSe8puLJECnvyd1R6JEouE/jfpiozJ+hAiAUqswFavcxNdV33E/S/uNmnbiahFsNECc8ysWncyBqJA=="}]},"maintainers":[{"name":"efrafa","email":"dano.husar@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/focus-trap_1.0.0_1541722765260_0.4707829165031159"},"_hasShrinkwrap":false},"1.0.1":{"name":"@daniel.husar/focus-trap","version":"1.0.1","description":"Add focus traps to the elements","scripts":{"test":"yarn lint && yarn test","unit":"jest","lint":"flow --quiet","build":"babel src/index.js --out-file dest/index.js && babel src/helpers.js --out-file dest/helpers.js","prepublish":"yarn build"},"main":"dest/index.js","author":{"name":"Daniel Husar"},"repository":{"type":"git","url":"git+https://github.com/danielhusar/focus-trap.git"},"keywords":["focus","trap","focus-trap","accesibility","a11y"],"license":"MIT","private":false,"devDependencies":{"@babel/cli":"^7.1.5","@babel/core":"^7.1.5","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/preset-env":"^7.1.5","@babel/preset-flow":"^7.0.0","babel-core":"^7.0.0-bridge","babel-jest":"^23.6.0","flow-bin":"^0.85.0","jest":"^23.6.0","prettier":"1.14.2"},"bugs":{"url":"https://github.com/danielhusar/focus-trap/issues"},"homepage":"https://github.com/danielhusar/focus-trap#readme","gitHead":"8f9fa0ed5bda828a42d887441d30aaff961401de","_id":"@daniel.husar/focus-trap@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"efrafa","email":"dano.husar@gmail.com"},"dist":{"integrity":"sha512-sKZ5yUuIaMv2Ti9M4uiA7c/LpEdN77FB6i5UDZA91mFyIJTLFY2xtrnN/lahJkdCx1a9CQnK2VIXXnYFimHpyg==","shasum":"0ca0bf9d3ad392edf1792eb4abcc2189183d1b4d","tarball":"https://registry.npmjs.org/@daniel.husar/focus-trap/-/focus-trap-1.0.1.tgz","fileCount":4,"unpackedSize":8123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5NWECRA9TVsSAnZWagAAa20P/2RKmqOATnpSLGd8Ofcg\ngW9X5ZG9N2xP4xzT9hXPSqjb4H2STx65/9KN8YGzDoEMFFABkFIb08BzPNYG\nwVXb+manaAgBJ+j8t7aRqEdrHA6esr7BerngaPnjxbQYnzHmq4qebOFp8vRL\nudZhigEVKrNS7VQ/+NnRCxoQPGz2JY1/bNOLVBgbi9ZFKWOWNkjBBFKpkqdp\nxC+TfvOl3O9rJ6d6wzM0p9+Z6/6o9HEFwWE/L4UK8ljaDq8iq7I7ek1QSTpk\nSTHAaiBvUT1l2rJ53dIHSefpIQsHjiVGjIv09kdynLGuZi19np3olbLypJDu\nNPVzZdcF3O6FmRpkemkHZmvkKEWWiRTNTcOudIHwFCORzGN72ac8W0mSJ8Qm\nCEUDZBNet8ziTinTVytYJsbMqnlC3dbXzsdrJfTzoRBPBFkqx6O/WLU9VlKa\n9Yy44Y1R+j4QsDt2oxh+BRf9JFIt05rxXnlC+jxprTvuOGsEq7Fk3BjPHl8C\nJOw+rp/AMB9itHAo8wjDnyRMAxzTuOHhqNRysA4t/ZwebxztPLDhYL35HVD9\nrmYtokX7xktSe7JOlroChckLHMuMjhtpfL18bF6U1CPAsIZguTeDR+IndDOz\nbR0FsNbDiatpKDQY/nUN9T1ZirwXlGzpDn7d4V55JtX1DnP9km5WzVCiilOn\npJ0J\r\n=Qjx5\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAK9ku4pw75yIoLmuWl2ZvY3Y6WxrQfqRaHyqXQ+7nM8AiEAgNGZyxVsaPDbKosG7cpiglcsM1m/lTim0vDg6mftr+Q="}]},"maintainers":[{"name":"efrafa","email":"dano.husar@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/focus-trap_1.0.1_1541723524162_0.3549077972790309"},"_hasShrinkwrap":false},"1.0.2":{"name":"@daniel.husar/focus-trap","version":"1.0.2","description":"Add focus traps to the elements","scripts":{"test":"yarn lint && yarn test","unit":"jest","lint":"flow --quiet","build":"babel src/index.js --out-file dest/index.js && babel src/helpers.js --out-file dest/helpers.js","prepublish":"yarn build"},"main":"dest/index.js","author":{"name":"Daniel Husar"},"repository":{"type":"git","url":"git+https://github.com/danielhusar/focus-trap.git"},"keywords":["focus","trap","focus-trap","accesibility","a11y"],"license":"MIT","private":false,"devDependencies":{"@babel/cli":"^7.1.5","@babel/core":"^7.1.5","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/preset-env":"^7.1.5","@babel/preset-flow":"^7.0.0","babel-core":"^7.0.0-bridge","babel-jest":"^23.6.0","flow-bin":"^0.85.0","jest":"^23.6.0","prettier":"1.14.2"},"bugs":{"url":"https://github.com/danielhusar/focus-trap/issues"},"homepage":"https://github.com/danielhusar/focus-trap#readme","gitHead":"00d406701b06a9aade39ef5452795b434129e752","_id":"@daniel.husar/focus-trap@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"efrafa","email":"dano.husar@gmail.com"},"dist":{"integrity":"sha512-hV9EOfQgGFJ9guW1uHGip7NQiOwNn+MqayuaGVICHhXwpT9pRHijf/5QOEeAixnS0+OyQVsTUL8Y3sD9iBxd2Q==","shasum":"5cfc4e28d85a74f2b5367523fade1565f4c7caf3","tarball":"https://registry.npmjs.org/@daniel.husar/focus-trap/-/focus-trap-1.0.2.tgz","fileCount":4,"unpackedSize":8115,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5NhtCRA9TVsSAnZWagAAviIP/iBTwoujaZZFz0JIUb3x\nNEqw2ElXALnYii3YW1+Nry37TtuzIIJyeTXUHPO04HoJP9CXQRjqLtC80jvH\nUxQcX+Rdg8taFXIFNPVbrth/4RnjnwGivpafRgfGe+aoWy5JMfE7DrzziZGF\n70NrwQ0aP7abq7bpJlr5I+XjoEUan/eHBrK4FTKm6iviLbsEiHH3UI1eU86P\nPpJde64+s/0Ikzja7wy1nGRnfJil8/A2fOQycVEggduq9c6oXSTErQVRwH5+\n4MY/yy1ChdGcOZxasCIHKS09dbf3ohwoXqOJ2hz5tTTEISJByQ7TK1t/NJIt\n8i1nMWS9fmzAgAJOoHdBUJjwq2fcWdmEsHrrd/m2gVPe053xl53tNmGg01gX\nFedLXWD9pp9Jo7X5YoLLLITZWqH2WttwGWLKiZ5B2EBWlq3qPGrwP1tWL3Ji\njW9RJH5ddzrOqwIs2JTxBvGIocPVczbROh4feVyeKudrnRHYkPSZtEyZC2tA\nGSr4a1mTx+ptqiI/npxbppm/KbHNaPyD2JlahF7JeNGmw5g0Td1JiXJqP8S+\nO42IgMt32/Rsz2YJWqc3ZRC66OXbMpiYSRcMTdknPY3qN0I+hkKXycM2EU7x\nzWwcC4xFiPiVEOW8TfbeklmO3b1oiJ2YhWtmYnSui/aXzCYWajBkdaDZBP79\nRyzO\r\n=F4+B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGZy8yYFBMDystyNO/1eLTWDieEhohf0Gn740kIDBxEOAiAkwhJQAt/pJHMyOBj5PUipl+hBygblXB34cQKDhK6Lgw=="}]},"maintainers":[{"name":"efrafa","email":"dano.husar@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/focus-trap_1.0.2_1541724268969_0.9128233921746032"},"_hasShrinkwrap":false},"1.0.3":{"name":"@daniel.husar/focus-trap","version":"1.0.3","description":"Add focus traps to the elements","scripts":{"test":"yarn lint && yarn test","unit":"jest","lint":"flow --quiet","build":"babel src/index.js --out-file dest/index.js && babel src/helpers.js --out-file dest/helpers.js","prepublish":"yarn build"},"main":"dest/index.js","author":{"name":"Daniel Husar"},"repository":{"type":"git","url":"git+https://github.com/danielhusar/focus-trap.git"},"keywords":["focus","trap","focus-trap","accesibility","a11y"],"license":"MIT","private":false,"devDependencies":{"@babel/cli":"^7.1.5","@babel/core":"^7.1.5","@babel/plugin-proposal-class-properties":"^7.1.0","@babel/plugin-proposal-object-rest-spread":"^7.0.0","@babel/preset-env":"^7.1.5","@babel/preset-flow":"^7.0.0","babel-core":"^7.0.0-bridge","babel-jest":"^23.6.0","flow-bin":"^0.85.0","jest":"^23.6.0","prettier":"1.14.2"},"bugs":{"url":"https://github.com/danielhusar/focus-trap/issues"},"homepage":"https://github.com/danielhusar/focus-trap#readme","gitHead":"f43616ddcf12af60667ece0088f36a45fa339f14","_id":"@daniel.husar/focus-trap@1.0.3","_npmVersion":"5.6.0","_nodeVersion":"8.9.4","_npmUser":{"name":"efrafa","email":"dano.husar@gmail.com"},"dist":{"integrity":"sha512-1Ais0uJvy9Vs42gYOxNr2AVOEZ/3reT4Jj33C3ZW+Py7GueHww6M7n0s9Ifn/kdwbiXj3n17zpUjvrEhkVE9vw==","shasum":"e364a010ad7ee4a8a37b1d4e9d4870ca6bb64305","tarball":"https://registry.npmjs.org/@daniel.husar/focus-trap/-/focus-trap-1.0.3.tgz","fileCount":4,"unpackedSize":8574,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb5PWICRA9TVsSAnZWagAAK+YP/3++53Rz5RMWHo+x8k4p\nu+60SiGV4hp01VQmY/bBWVPlgodEJXHrBCOx8vshxvXBgAntolj5z/yHiAZH\nNxDBlC0QfnPuUPMI3uYRngwhRO+zAh/M3UsDwu7FP3RsWHPdXqDYtT0Dgru1\nxjgwduKvJ6+XVJLOacCcssYZuL6wEetpeqi3yJy9Fv8hKb+oliecE7N/eg0S\n5h3OZxEZofpUWUu897D99wlIBUjkf0simPBXLeFE/TfFg55U7TI31QTUKzpM\nRJcm8OJXOLOSN028LPLLlDXku+IS1eRqcV+HfIAu2QdueFMN2dPrmveGFbOh\n9v7m9RLPT0lAklBcTijfvR0SLlqpHcK8o+CjFATPJLSC/h6QQ8Op6EOypJqH\n5zSj69r4IzubjLl+Z+mCLqkweCeVFi+ZX9eqcbigMlNxEzxR6Bdiaa5r1/Sg\nFi9UYdqfYBPLWkrHyj0Pm+RfZ7d4h403a7Szmnne7pUewIG7W7WDLsMpfC85\nNljDuHZjE+HropOC4cHl0jBLsU1U/IsXAVnWtvybU0Op11WriknI5gqXN0kM\n7k4oZ0xPxlYDVz/b307yTTLgILrS3SFXNluGels8VrDdIhA4w3iARZVpNseM\n2aF8PB71CEUTz7jewjQpE3CSGWHWwz/PhEgVmKwz+Eab7sn5ODJaor46FJOI\nguWb\r\n=Q75r\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDscPJzZvlv/YX7pEF+ltFWxcJpuDgLckcTCiPJRfgc6wIhAKSjjqleKVeG4PtBciyshFT+q3WlrwuDWAD3AQPco5FS"}]},"maintainers":[{"name":"efrafa","email":"dano.husar@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/focus-trap_1.0.3_1541731719617_0.3480527387120873"},"_hasShrinkwrap":false}},"time":{"created":"2018-11-09T00:19:25.098Z","1.0.0":"2018-11-09T00:19:25.402Z","modified":"2022-04-05T02:40:30.585Z","1.0.1":"2018-11-09T00:32:04.314Z","1.0.2":"2018-11-09T00:44:29.091Z","1.0.3":"2018-11-09T02:48:39.739Z"},"maintainers":[{"name":"efrafa","email":"dano.husar@gmail.com"}],"description":"Add focus traps to the elements","homepage":"https://github.com/danielhusar/focus-trap#readme","keywords":["focus","trap","focus-trap","accesibility","a11y"],"repository":{"type":"git","url":"git+https://github.com/danielhusar/focus-trap.git"},"author":{"name":"Daniel Husar"},"bugs":{"url":"https://github.com/danielhusar/focus-trap/issues"},"license":"MIT","readme":"# focus-trap\n\n > Add focus traps around elements.\n\nAdding a focus traps is important part of making your site accessible. The most common example where you want to set up a focus trap is a modal. While modal is open, the user shouldn't be able to tab outside of it, and focus should be locked within the modal elements. You have to remember to make sure there is always a way how to exit this focus trap. In modal example it's usually the escape key, or close button in the corner.\n\n [Demo](https://codesandbox.io/s/4rn8vm4nv0)\n\n## Install\n\nUsing npm\n```sh\nnpm install @daniel.husar/focus-trap\n```\n\nUsing yarn\n```sh\nyarn add @daniel.husar/focus-trap\n```\n\n## Usage\n\n```javascript\nimport FocusTrap from '@daniel.husar/focus-trap';\n// Setup trap\nconst trap = new FocusTrap({ node: document.querySelector('#my-trap') });\n// Release trap\ntrap.restore();\n```\n\n### Constructor API\nConstructor accept object with those properties:\n\n```javascript\nnew FocusTrap({\n  node: document.querySelector('#my-trap') }),\n  firstElement: () => document.querySelector('#first-element'),\n  lastElement: () => document.querySelector('#last-element'),\n  disableStartingTrap: () => false,\n  disableEndingTrap: () => false,\n});\n```\n\n#### node\n\nType: `DOM element`\n\nDefault: `none`\n\nRequired: `true`\n\nThis is the DOM node you want to set-up focus trap around\n\n#### firstElement\n\nType: `Function`\n\nDefault: `() => null`\n\nRequired: `none`\n\nFunction that returns element that will replace first element when focus will jump back at the start. Usefull when you want to connect 2 focus traps together. Will fallback to firstElement in focus trap if function returns falsy value.\n\n#### lastElement\n\nType: `Function`\n\nDefault: `() => null`\n\nRequired: `none`\n\nFunction that returns element that will replace last element when focus will jump back at the end. Usefull when you want to connect 2 focus traps together. Will fallback to lastElement in focus trap if function returns falsy value.\n\n#### disableStartingTrap\n\nType: `Function`\n\nDefault: `() => false`\n\nRequired: `none`\n\nFunction that returns boolean if the starting trap should be disabled.\n\n#### disableEndingTrap\n\nType: `Function`\n\nDefault: `() => false`\n\nRequired: `none`\n\nFunction that can returns boolean if the ending trap should be disabled.\n\n### Interface\n\n#### recalculateFocusableElements\n\nType: `Function`\n\nRecalculate focusable elements inside of your trap. Usefull if content of the node changes over time.\n\n#### restore\n\nType: `Function`\n\nRemove the focus trap from element.\n\n## License\n\nMIT © [Daniel Husar](https://github.com/danielhusar)\n","readmeFilename":"readme.md"}