focus-trap 7.6.2 β 7.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +22 -10
- package/dist/focus-trap.esm.js +68 -45
- package/dist/focus-trap.esm.js.map +1 -1
- package/dist/focus-trap.esm.min.js +2 -2
- package/dist/focus-trap.esm.min.js.map +1 -1
- package/dist/focus-trap.js +67 -44
- package/dist/focus-trap.js.map +1 -1
- package/dist/focus-trap.min.js +2 -2
- package/dist/focus-trap.min.js.map +1 -1
- package/dist/focus-trap.umd.js +67 -44
- package/dist/focus-trap.umd.js.map +1 -1
- package/dist/focus-trap.umd.min.js +2 -2
- package/dist/focus-trap.umd.min.js.map +1 -1
- package/index.d.ts +29 -9
- package/index.js +56 -25
- package/package.json +28 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.6.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bb47f7a: Remove engine requirement that crept into `package.json`. Sorry about that! ([#1343](https://github.com/focus-trap/focus-trap/issues/1343))
|
|
8
|
+
|
|
9
|
+
## 7.6.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 0a9b746: Prevent a previous focus trap that is manually paused from being automatically unpaused when the current trap is deactivated. Also prevent a paused trap that is not at the top of the stack from being unpaused.
|
|
14
|
+
|
|
3
15
|
## 7.6.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# focus-trap [](https://github.com/focus-trap/focus-trap/actions?query=workflow:CI+branch:master) [](./LICENSE)
|
|
2
2
|
|
|
3
3
|
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
4
|
-
[](#contributors)
|
|
5
5
|
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
6
6
|
|
|
7
7
|
Trap focus within a DOM node.
|
|
@@ -231,6 +231,10 @@ Pause an active focus trap's event listening without deactivating the trap.
|
|
|
231
231
|
|
|
232
232
|
If the focus trap has not been activated, nothing happens.
|
|
233
233
|
|
|
234
|
+
Whether the trap is already paused or not, its paused state becomes __manually-paused__ even if the trap has already been auto-paused as a result of another trap being activated after this one (and so being higher on the stack than this one).
|
|
235
|
+
|
|
236
|
+
> Note that a manually-paused trap will not be auto-unpaused if it becomes the trap at the top of the `trapStack` again by way of all other traps higher than it on the stack being deactivated. It will remain paused until manually unpaused by calling `unpause()`. If the trap was auto-paused the entire time it was not at the top of the stack, then it will be auto-unpaused when it gets to the top of the stack again.
|
|
237
|
+
|
|
234
238
|
Returns the `trap`.
|
|
235
239
|
|
|
236
240
|
Any `onDeactivate` callback will not be called, and focus will not return to the element that was focused before the trap's activation. But the trap's behavior will be paused.
|
|
@@ -254,7 +258,11 @@ Unpause an active focus trap. (See `pause()`, above.)
|
|
|
254
258
|
|
|
255
259
|
Focus is forced into the trap just as described for `focusTrap.activate()`.
|
|
256
260
|
|
|
257
|
-
If the focus trap has not been activated
|
|
261
|
+
If the focus trap has not been activated, nothing happens.
|
|
262
|
+
|
|
263
|
+
If the focus trap has not been paused, nothing happens other than resetting its __manually-paused__ state.
|
|
264
|
+
|
|
265
|
+
If the focus trap is not at the top of the `trapStack`, it will not be unpaused (whether previously auto- or manually-paused) until all traps higher on the stack have been deactivated and this trap becomes the one at the top again.
|
|
258
266
|
|
|
259
267
|
Returns the `trap`.
|
|
260
268
|
|
|
@@ -379,45 +387,49 @@ In alphabetical order:
|
|
|
379
387
|
<tr>
|
|
380
388
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/andersthorsen"><img src="https://avatars.githubusercontent.com/u/190081?v=4?s=100" width="100px;" alt="Anders Thorsen"/><br /><sub><b>Anders Thorsen</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Aandersthorsen" title="Bug reports">π</a></td>
|
|
381
389
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bparish628"><img src="https://avatars1.githubusercontent.com/u/8492971?v=4?s=100" width="100px;" alt="Benjamin Parish"/><br /><sub><b>Benjamin Parish</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Abparish628" title="Bug reports">π</a></td>
|
|
390
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/bernhardoj"><img src="https://avatars.githubusercontent.com/u/50919443?v=4?s=100" width="100px;" alt="Bernhard Owen Josephus"/><br /><sub><b>Bernhard Owen Josephus</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=bernhardoj" title="Code">π»</a></td>
|
|
391
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/chrisbishop-looka"><img src="https://avatars.githubusercontent.com/u/128391384?v=4?s=100" width="100px;" alt="Chris Bishop"/><br /><sub><b>Chris Bishop</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Achrisbishop-looka" title="Bug reports">π</a></td>
|
|
382
392
|
<td align="center" valign="top" width="14.28%"><a href="https://clintgoodman.com"><img src="https://avatars3.githubusercontent.com/u/5473697?v=4?s=100" width="100px;" alt="Clint Goodman"/><br /><sub><b>Clint Goodman</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=cgood92" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=cgood92" title="Documentation">π</a> <a href="#example-cgood92" title="Examples">π‘</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=cgood92" title="Tests">β οΈ</a></td>
|
|
383
393
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/Dan503"><img src="https://avatars.githubusercontent.com/u/10610368?v=4?s=100" width="100px;" alt="Daniel Tonon"/><br /><sub><b>Daniel Tonon</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=Dan503" title="Documentation">π</a> <a href="#tool-Dan503" title="Tools">π§</a> <a href="#a11y-Dan503" title="Accessibility">οΈοΈοΈοΈβΏοΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=Dan503" title="Code">π»</a></td>
|
|
384
394
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/DaviDevMod"><img src="https://avatars.githubusercontent.com/u/98312056?v=4?s=100" width="100px;" alt="DaviDevMod"/><br /><sub><b>DaviDevMod</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=DaviDevMod" title="Documentation">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=DaviDevMod" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3ADaviDevMod" title="Bug reports">π</a></td>
|
|
385
|
-
<td align="center" valign="top" width="14.28%"><a href="http://davidtheclark.com/"><img src="https://avatars2.githubusercontent.com/u/628431?v=4?s=100" width="100px;" alt="David Clark"/><br /><sub><b>David Clark</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=davidtheclark" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Adavidtheclark" title="Bug reports">π</a> <a href="#infra-davidtheclark" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=davidtheclark" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=davidtheclark" title="Documentation">π</a> <a href="#maintenance-davidtheclark" title="Maintenance">π§</a></td>
|
|
386
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/features/security"><img src="https://avatars1.githubusercontent.com/u/27347476?v=4?s=100" width="100px;" alt="Dependabot"/><br /><sub><b>Dependabot</b></sub></a><br /><a href="#maintenance-dependabot" title="Maintenance">π§</a></td>
|
|
387
395
|
</tr>
|
|
388
396
|
<tr>
|
|
397
|
+
<td align="center" valign="top" width="14.28%"><a href="http://davidtheclark.com/"><img src="https://avatars2.githubusercontent.com/u/628431?v=4?s=100" width="100px;" alt="David Clark"/><br /><sub><b>David Clark</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=davidtheclark" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Adavidtheclark" title="Bug reports">π</a> <a href="#infra-davidtheclark" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=davidtheclark" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=davidtheclark" title="Documentation">π</a> <a href="#maintenance-davidtheclark" title="Maintenance">π§</a></td>
|
|
398
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/features/security"><img src="https://avatars1.githubusercontent.com/u/27347476?v=4?s=100" width="100px;" alt="Dependabot"/><br /><sub><b>Dependabot</b></sub></a><br /><a href="#maintenance-dependabot" title="Maintenance">π§</a></td>
|
|
389
399
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jcfranco"><img src="https://avatars.githubusercontent.com/u/197440?v=4?s=100" width="100px;" alt="JC Franco"/><br /><sub><b>JC Franco</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=jcfranco" title="Code">π»</a></td>
|
|
390
400
|
<td align="center" valign="top" width="14.28%"><a href="https://www.schilljs.com/"><img src="https://avatars.githubusercontent.com/u/213943?v=4?s=100" width="100px;" alt="Joas Schilling"/><br /><sub><b>Joas Schilling</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/pulls?q=is%3Apr+reviewed-by%3Anickvergessen" title="Reviewed Pull Requests">π</a></td>
|
|
391
401
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/skjnldsv"><img src="https://avatars.githubusercontent.com/u/14975046?v=4?s=100" width="100px;" alt="John MolakvoΓ¦"/><br /><sub><b>John MolakvoΓ¦</b></sub></a><br /><a href="#ideas-skjnldsv" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
392
402
|
<td align="center" valign="top" width="14.28%"><a href="http://reload.dk"><img src="https://avatars.githubusercontent.com/u/73966?v=4?s=100" width="100px;" alt="Kasper GarnΓ¦s"/><br /><sub><b>Kasper GarnΓ¦s</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=kasperg" title="Documentation">π</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Akasperg" title="Bug reports">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=kasperg" title="Code">π»</a></td>
|
|
393
403
|
<td align="center" valign="top" width="14.28%"><a href="http://blogs.esri.com/esri/arcgis/"><img src="https://avatars.githubusercontent.com/u/1231455?v=4?s=100" width="100px;" alt="Matt Driscoll"/><br /><sub><b>Matt Driscoll</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Adriskull" title="Bug reports">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=driskull" title="Code">π»</a> <a href="#tutorial-driskull" title="Tutorials">β
</a></td>
|
|
394
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/msev"><img src="https://avatars.githubusercontent.com/u/1529562?v=4?s=100" width="100px;" alt="Maxime"/><br /><sub><b>Maxime</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Amsev" title="Bug reports">π</a></td>
|
|
395
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/michael-ar"><img src="https://avatars3.githubusercontent.com/u/18557997?v=4?s=100" width="100px;" alt="Michael Reynolds"/><br /><sub><b>Michael Reynolds</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Amichael-ar" title="Bug reports">π</a></td>
|
|
396
404
|
</tr>
|
|
397
405
|
<tr>
|
|
406
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/msev"><img src="https://avatars.githubusercontent.com/u/1529562?v=4?s=100" width="100px;" alt="Maxime"/><br /><sub><b>Maxime</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Amsev" title="Bug reports">π</a></td>
|
|
407
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/michael-ar"><img src="https://avatars3.githubusercontent.com/u/18557997?v=4?s=100" width="100px;" alt="Michael Reynolds"/><br /><sub><b>Michael Reynolds</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Amichael-ar" title="Bug reports">π</a></td>
|
|
398
408
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/liunate"><img src="https://avatars2.githubusercontent.com/u/38996291?v=4?s=100" width="100px;" alt="Nate Liu"/><br /><sub><b>Nate Liu</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=liunate" title="Tests">β οΈ</a></td>
|
|
399
409
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/far-fetched"><img src="https://avatars.githubusercontent.com/u/11621383?v=4?s=100" width="100px;" alt="Piotr Panek"/><br /><sub><b>Piotr Panek</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Afar-fetched" title="Bug reports">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=far-fetched" title="Documentation">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=far-fetched" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=far-fetched" title="Tests">β οΈ</a></td>
|
|
400
410
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/randypuro"><img src="https://avatars2.githubusercontent.com/u/2579?v=4?s=100" width="100px;" alt="Randy Puro"/><br /><sub><b>Randy Puro</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Arandypuro" title="Bug reports">π</a></td>
|
|
401
411
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/sadick254"><img src="https://avatars2.githubusercontent.com/u/5238135?v=4?s=100" width="100px;" alt="Sadick"/><br /><sub><b>Sadick</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=sadick254" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=sadick254" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=sadick254" title="Documentation">π</a></td>
|
|
402
412
|
<td align="center" valign="top" width="14.28%"><a href="https://scottblinch.me/"><img src="https://avatars2.githubusercontent.com/u/4682114?v=4?s=100" width="100px;" alt="Scott Blinch"/><br /><sub><b>Scott Blinch</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=scottblinch" title="Documentation">π</a></td>
|
|
403
|
-
<td align="center" valign="top" width="14.28%"><a href="https://seanmcp.com/"><img src="https://avatars1.githubusercontent.com/u/6360367?v=4?s=100" width="100px;" alt="Sean McPherson"/><br /><sub><b>Sean McPherson</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=SeanMcP" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=SeanMcP" title="Documentation">π</a></td>
|
|
404
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/skriems"><img src="https://avatars.githubusercontent.com/u/15573317?v=4?s=100" width="100px;" alt="Sebastian Kriems"/><br /><sub><b>Sebastian Kriems</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Askriems" title="Bug reports">π</a></td>
|
|
405
413
|
</tr>
|
|
406
414
|
<tr>
|
|
415
|
+
<td align="center" valign="top" width="14.28%"><a href="https://seanmcp.com/"><img src="https://avatars1.githubusercontent.com/u/6360367?v=4?s=100" width="100px;" alt="Sean McPherson"/><br /><sub><b>Sean McPherson</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=SeanMcP" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=SeanMcP" title="Documentation">π</a></td>
|
|
416
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/skriems"><img src="https://avatars.githubusercontent.com/u/15573317?v=4?s=100" width="100px;" alt="Sebastian Kriems"/><br /><sub><b>Sebastian Kriems</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Askriems" title="Bug reports">π</a></td>
|
|
407
417
|
<td align="center" valign="top" width="14.28%"><a href="https://recollectr.io"><img src="https://avatars2.githubusercontent.com/u/6835891?v=4?s=100" width="100px;" alt="Slapbox"/><br /><sub><b>Slapbox</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3ASlapbox" title="Bug reports">π</a></td>
|
|
408
418
|
<td align="center" valign="top" width="14.28%"><a href="https://stefancameron.com/"><img src="https://avatars3.githubusercontent.com/u/2855350?v=4?s=100" width="100px;" alt="Stefan Cameron"/><br /><sub><b>Stefan Cameron</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=stefcameron" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Astefcameron" title="Bug reports">π</a> <a href="#infra-stefcameron" title="Infrastructure (Hosting, Build-Tools, etc)">π</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=stefcameron" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=stefcameron" title="Documentation">π</a> <a href="#maintenance-stefcameron" title="Maintenance">π§</a></td>
|
|
409
419
|
<td align="center" valign="top" width="14.28%"><a href="http://tylerhawkins.info/201R/"><img src="https://avatars0.githubusercontent.com/u/13806458?v=4?s=100" width="100px;" alt="Tyler Hawkins"/><br /><sub><b>Tyler Hawkins</b></sub></a><br /><a href="#tool-thawkin3" title="Tools">π§</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=thawkin3" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=thawkin3" title="Documentation">π</a></td>
|
|
410
420
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/vasiliki-b"><img src="https://avatars.githubusercontent.com/u/98032598?v=4?s=100" width="100px;" alt="Vasiliki Boutas"/><br /><sub><b>Vasiliki Boutas</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Avasiliki-b" title="Bug reports">π</a></td>
|
|
411
421
|
<td align="center" valign="top" width="14.28%"><a href="https://vinicius73.dev/"><img src="https://avatars.githubusercontent.com/u/1561347?v=4?s=100" width="100px;" alt="Vinicius Reis"/><br /><sub><b>Vinicius Reis</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=vinicius73" title="Code">π»</a> <a href="#ideas-vinicius73" title="Ideas, Planning, & Feedback">π€</a></td>
|
|
412
|
-
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wandroll"><img src="https://avatars.githubusercontent.com/u/4492317?v=4?s=100" width="100px;" alt="Wandrille Verlut"/><br /><sub><b>Wandrille Verlut</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=wandroll" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=wandroll" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=wandroll" title="Documentation">π</a> <a href="#tool-wandroll" title="Tools">π§</a></td>
|
|
413
|
-
<td align="center" valign="top" width="14.28%"><a href="http://willmruzek.com/"><img src="https://avatars.githubusercontent.com/u/108522?v=4?s=100" width="100px;" alt="Will Mruzek"/><br /><sub><b>Will Mruzek</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=mruzekw" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=mruzekw" title="Documentation">π</a> <a href="#example-mruzekw" title="Examples">π‘</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=mruzekw" title="Tests">β οΈ</a> <a href="#question-mruzekw" title="Answering Questions">π¬</a></td>
|
|
414
422
|
</tr>
|
|
415
423
|
<tr>
|
|
424
|
+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wandroll"><img src="https://avatars.githubusercontent.com/u/4492317?v=4?s=100" width="100px;" alt="Wandrille Verlut"/><br /><sub><b>Wandrille Verlut</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=wandroll" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=wandroll" title="Tests">β οΈ</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=wandroll" title="Documentation">π</a> <a href="#tool-wandroll" title="Tools">π§</a></td>
|
|
425
|
+
<td align="center" valign="top" width="14.28%"><a href="http://willmruzek.com/"><img src="https://avatars.githubusercontent.com/u/108522?v=4?s=100" width="100px;" alt="Will Mruzek"/><br /><sub><b>Will Mruzek</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=mruzekw" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=mruzekw" title="Documentation">π</a> <a href="#example-mruzekw" title="Examples">π‘</a> <a href="https://github.com/focus-trap/focus-trap/commits?author=mruzekw" title="Tests">β οΈ</a> <a href="#question-mruzekw" title="Answering Questions">π¬</a></td>
|
|
416
426
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/zioth"><img src="https://avatars3.githubusercontent.com/u/945603?v=4?s=100" width="100px;" alt="Zioth"/><br /><sub><b>Zioth</b></sub></a><br /><a href="#ideas-zioth" title="Ideas, Planning, & Feedback">π€</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Azioth" title="Bug reports">π</a></td>
|
|
417
427
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/glushkova91"><img src="https://avatars.githubusercontent.com/u/13402897?v=4?s=100" width="100px;" alt="glushkova91"/><br /><sub><b>glushkova91</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=glushkova91" title="Documentation">π</a></td>
|
|
418
428
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jpveooys"><img src="https://avatars.githubusercontent.com/u/66470099?v=4?s=100" width="100px;" alt="jpveooys"/><br /><sub><b>jpveooys</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Ajpveooys" title="Bug reports">π</a></td>
|
|
419
429
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/konradr33"><img src="https://avatars.githubusercontent.com/u/32595283?v=4?s=100" width="100px;" alt="konradr33"/><br /><sub><b>konradr33</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Akonradr33" title="Bug reports">π</a></td>
|
|
420
430
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/tomasvn"><img src="https://avatars.githubusercontent.com/u/17225564?v=4?s=100" width="100px;" alt="tomasvn"/><br /><sub><b>tomasvn</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=tomasvn" title="Code">π»</a></td>
|
|
431
|
+
</tr>
|
|
432
|
+
<tr>
|
|
421
433
|
<td align="center" valign="top" width="14.28%"><a href="https://github.com/simonxabris"><img src="https://avatars.githubusercontent.com/u/27497229?v=4?s=100" width="100px;" alt="Γbris Simon"/><br /><sub><b>Γbris Simon</b></sub></a><br /><a href="https://github.com/focus-trap/focus-trap/commits?author=simonxabris" title="Code">π»</a> <a href="https://github.com/focus-trap/focus-trap/issues?q=author%3Asimonxabris" title="Bug reports">π</a></td>
|
|
422
434
|
</tr>
|
|
423
435
|
</tbody>
|
package/dist/focus-trap.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* focus-trap 7.6.
|
|
2
|
+
* focus-trap 7.6.4
|
|
3
3
|
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { tabbable, focusable, isTabbable, getTabIndex, isFocusable } from 'tabbable';
|
|
6
6
|
|
|
7
7
|
function _arrayLikeToArray(r, a) {
|
|
8
8
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -15,9 +15,9 @@ function _arrayWithoutHoles(r) {
|
|
|
15
15
|
function _defineProperty(e, r, t) {
|
|
16
16
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
17
17
|
value: t,
|
|
18
|
-
enumerable:
|
|
19
|
-
configurable:
|
|
20
|
-
writable:
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
21
|
}) : e[r] = t, e;
|
|
22
22
|
}
|
|
23
23
|
function _iterableToArray(r) {
|
|
@@ -39,7 +39,7 @@ function ownKeys(e, r) {
|
|
|
39
39
|
function _objectSpread2(e) {
|
|
40
40
|
for (var r = 1; r < arguments.length; r++) {
|
|
41
41
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
42
|
-
r % 2 ? ownKeys(Object(t),
|
|
42
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
43
43
|
_defineProperty(e, r, t[r]);
|
|
44
44
|
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
45
45
|
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
@@ -53,7 +53,7 @@ function _toConsumableArray(r) {
|
|
|
53
53
|
function _toPrimitive(t, r) {
|
|
54
54
|
if ("object" != typeof t || !t) return t;
|
|
55
55
|
var e = t[Symbol.toPrimitive];
|
|
56
|
-
if (
|
|
56
|
+
if (undefined !== e) {
|
|
57
57
|
var i = e.call(t, r || "default");
|
|
58
58
|
if ("object" != typeof i) return i;
|
|
59
59
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
@@ -68,7 +68,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
68
68
|
if (r) {
|
|
69
69
|
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
70
70
|
var t = {}.toString.call(r).slice(8, -1);
|
|
71
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) :
|
|
71
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : undefined;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -77,7 +77,7 @@ var activeFocusTraps = {
|
|
|
77
77
|
if (trapStack.length > 0) {
|
|
78
78
|
var activeTrap = trapStack[trapStack.length - 1];
|
|
79
79
|
if (activeTrap !== trap) {
|
|
80
|
-
activeTrap.
|
|
80
|
+
activeTrap._setPausedState(true);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
var trapIndex = trapStack.indexOf(trap);
|
|
@@ -94,8 +94,8 @@ var activeFocusTraps = {
|
|
|
94
94
|
if (trapIndex !== -1) {
|
|
95
95
|
trapStack.splice(trapIndex, 1);
|
|
96
96
|
}
|
|
97
|
-
if (trapStack.length > 0) {
|
|
98
|
-
trapStack[trapStack.length - 1].
|
|
97
|
+
if (trapStack.length > 0 && !trapStack[trapStack.length - 1]._isManuallyPaused()) {
|
|
98
|
+
trapStack[trapStack.length - 1]._setPausedState(false);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
};
|
|
@@ -103,10 +103,10 @@ var isSelectableInput = function isSelectableInput(node) {
|
|
|
103
103
|
return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
|
|
104
104
|
};
|
|
105
105
|
var isEscapeEvent = function isEscapeEvent(e) {
|
|
106
|
-
return (e === null || e ===
|
|
106
|
+
return (e === null || e === undefined ? undefined : e.key) === 'Escape' || (e === null || e === undefined ? undefined : e.key) === 'Esc' || (e === null || e === undefined ? undefined : e.keyCode) === 27;
|
|
107
107
|
};
|
|
108
108
|
var isTabEvent = function isTabEvent(e) {
|
|
109
|
-
return (e === null || e ===
|
|
109
|
+
return (e === null || e === undefined ? undefined : e.key) === 'Tab' || (e === null || e === undefined ? undefined : e.keyCode) === 9;
|
|
110
110
|
};
|
|
111
111
|
|
|
112
112
|
// checks for TAB by default
|
|
@@ -133,7 +133,7 @@ var valueOrHandler = function valueOrHandler(value) {
|
|
|
133
133
|
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
134
134
|
params[_key - 1] = arguments[_key];
|
|
135
135
|
}
|
|
136
|
-
return typeof value === 'function' ? value.apply(
|
|
136
|
+
return typeof value === 'function' ? value.apply(undefined, params) : value;
|
|
137
137
|
};
|
|
138
138
|
var getActualTarget = function getActualTarget(event) {
|
|
139
139
|
// NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
|
|
@@ -152,8 +152,8 @@ var internalTrapStack = [];
|
|
|
152
152
|
var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
153
153
|
// SSR: a live trap shouldn't be created in this type of environment so this
|
|
154
154
|
// should be safe code to execute if the `document` option isn't specified
|
|
155
|
-
var doc = (userOptions === null || userOptions ===
|
|
156
|
-
var trapStack = (userOptions === null || userOptions ===
|
|
155
|
+
var doc = (userOptions === null || userOptions === undefined ? undefined : userOptions.document) || document;
|
|
156
|
+
var trapStack = (userOptions === null || userOptions === undefined ? undefined : userOptions.trapStack) || internalTrapStack;
|
|
157
157
|
var config = _objectSpread2({
|
|
158
158
|
returnFocusOnDeactivate: true,
|
|
159
159
|
escapeDeactivates: true,
|
|
@@ -193,6 +193,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
193
193
|
mostRecentlyFocusedNode: null,
|
|
194
194
|
active: false,
|
|
195
195
|
paused: false,
|
|
196
|
+
manuallyPaused: false,
|
|
196
197
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
197
198
|
// has been delayed during activation
|
|
198
199
|
delayInitialFocusTimer: undefined,
|
|
@@ -224,7 +225,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
224
225
|
* if the element isn't found.
|
|
225
226
|
*/
|
|
226
227
|
var findContainerIndex = function findContainerIndex(element, event) {
|
|
227
|
-
var composedPath = typeof (event === null || event ===
|
|
228
|
+
var composedPath = typeof (event === null || event === undefined ? undefined : event.composedPath) === 'function' ? event.composedPath() : undefined;
|
|
228
229
|
// NOTE: search `containerGroups` because it's possible a group contains no tabbable
|
|
229
230
|
// nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
|
|
230
231
|
// and we still need to find the element in there
|
|
@@ -235,7 +236,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
235
236
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
236
237
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
237
238
|
// look inside web components even if open)
|
|
238
|
-
composedPath === null || composedPath ===
|
|
239
|
+
composedPath === null || composedPath === undefined ? undefined : composedPath.includes(container)) || tabbableNodes.find(function (node) {
|
|
239
240
|
return node === element;
|
|
240
241
|
});
|
|
241
242
|
});
|
|
@@ -262,12 +263,12 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
262
263
|
var getNodeForOption = function getNodeForOption(optionName) {
|
|
263
264
|
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
264
265
|
_ref2$hasFallback = _ref2.hasFallback,
|
|
265
|
-
hasFallback = _ref2$hasFallback ===
|
|
266
|
+
hasFallback = _ref2$hasFallback === undefined ? false : _ref2$hasFallback,
|
|
266
267
|
_ref2$params = _ref2.params,
|
|
267
|
-
params = _ref2$params ===
|
|
268
|
+
params = _ref2$params === undefined ? [] : _ref2$params;
|
|
268
269
|
var optionValue = config[optionName];
|
|
269
270
|
if (typeof optionValue === 'function') {
|
|
270
|
-
optionValue = optionValue.apply(
|
|
271
|
+
optionValue = optionValue.apply(undefined, _toConsumableArray(params));
|
|
271
272
|
}
|
|
272
273
|
if (optionValue === true) {
|
|
273
274
|
optionValue = undefined; // use default value
|
|
@@ -483,7 +484,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
483
484
|
var target = _ref3.target,
|
|
484
485
|
event = _ref3.event,
|
|
485
486
|
_ref3$isBackward = _ref3.isBackward,
|
|
486
|
-
isBackward = _ref3$isBackward ===
|
|
487
|
+
isBackward = _ref3$isBackward === undefined ? false : _ref3$isBackward;
|
|
487
488
|
target = target || getActualTarget(event);
|
|
488
489
|
updateTabbableNodes();
|
|
489
490
|
var destinationNode = null;
|
|
@@ -865,14 +866,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
865
866
|
state.active = true;
|
|
866
867
|
state.paused = false;
|
|
867
868
|
state.nodeFocusedBeforeActivation = doc.activeElement;
|
|
868
|
-
onActivate === null || onActivate ===
|
|
869
|
+
onActivate === null || onActivate === undefined || onActivate();
|
|
869
870
|
var finishActivation = function finishActivation() {
|
|
870
871
|
if (checkCanFocusTrap) {
|
|
871
872
|
updateTabbableNodes();
|
|
872
873
|
}
|
|
873
874
|
addListeners();
|
|
874
875
|
updateObservedNodes();
|
|
875
|
-
onPostActivate === null || onPostActivate ===
|
|
876
|
+
onPostActivate === null || onPostActivate === undefined || onPostActivate();
|
|
876
877
|
};
|
|
877
878
|
if (checkCanFocusTrap) {
|
|
878
879
|
checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
|
|
@@ -901,13 +902,13 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
901
902
|
var onPostDeactivate = getOption(options, 'onPostDeactivate');
|
|
902
903
|
var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
|
|
903
904
|
var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
|
|
904
|
-
onDeactivate === null || onDeactivate ===
|
|
905
|
+
onDeactivate === null || onDeactivate === undefined || onDeactivate();
|
|
905
906
|
var finishDeactivation = function finishDeactivation() {
|
|
906
907
|
delay(function () {
|
|
907
908
|
if (returnFocus) {
|
|
908
909
|
_tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
|
909
910
|
}
|
|
910
|
-
onPostDeactivate === null || onPostDeactivate ===
|
|
911
|
+
onPostDeactivate === null || onPostDeactivate === undefined || onPostDeactivate();
|
|
911
912
|
});
|
|
912
913
|
};
|
|
913
914
|
if (returnFocus && checkCanReturnFocus) {
|
|
@@ -918,31 +919,21 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
918
919
|
return this;
|
|
919
920
|
},
|
|
920
921
|
pause: function pause(pauseOptions) {
|
|
921
|
-
if (
|
|
922
|
+
if (!state.active) {
|
|
922
923
|
return this;
|
|
923
924
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
state.paused = true;
|
|
927
|
-
onPause === null || onPause === void 0 || onPause();
|
|
928
|
-
removeListeners();
|
|
929
|
-
updateObservedNodes();
|
|
930
|
-
onPostPause === null || onPostPause === void 0 || onPostPause();
|
|
931
|
-
return this;
|
|
925
|
+
state.manuallyPaused = true;
|
|
926
|
+
return this._setPausedState(true, pauseOptions);
|
|
932
927
|
},
|
|
933
928
|
unpause: function unpause(unpauseOptions) {
|
|
934
|
-
if (!state.
|
|
929
|
+
if (!state.active) {
|
|
935
930
|
return this;
|
|
936
931
|
}
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
addListeners();
|
|
943
|
-
updateObservedNodes();
|
|
944
|
-
onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
|
|
945
|
-
return this;
|
|
932
|
+
state.manuallyPaused = false;
|
|
933
|
+
if (trapStack[trapStack.length - 1] !== this) {
|
|
934
|
+
return this;
|
|
935
|
+
}
|
|
936
|
+
return this._setPausedState(false, unpauseOptions);
|
|
946
937
|
},
|
|
947
938
|
updateContainerElements: function updateContainerElements(containerElements) {
|
|
948
939
|
var elementsAsArray = [].concat(containerElements).filter(Boolean);
|
|
@@ -956,6 +947,38 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
956
947
|
return this;
|
|
957
948
|
}
|
|
958
949
|
};
|
|
950
|
+
Object.defineProperties(trap, {
|
|
951
|
+
_isManuallyPaused: {
|
|
952
|
+
value: function value() {
|
|
953
|
+
return state.manuallyPaused;
|
|
954
|
+
}
|
|
955
|
+
},
|
|
956
|
+
_setPausedState: {
|
|
957
|
+
value: function value(paused, options) {
|
|
958
|
+
if (state.paused === paused) {
|
|
959
|
+
return this;
|
|
960
|
+
}
|
|
961
|
+
state.paused = paused;
|
|
962
|
+
if (paused) {
|
|
963
|
+
var onPause = getOption(options, 'onPause');
|
|
964
|
+
var onPostPause = getOption(options, 'onPostPause');
|
|
965
|
+
onPause === null || onPause === undefined || onPause();
|
|
966
|
+
removeListeners();
|
|
967
|
+
updateObservedNodes();
|
|
968
|
+
onPostPause === null || onPostPause === undefined || onPostPause();
|
|
969
|
+
} else {
|
|
970
|
+
var onUnpause = getOption(options, 'onUnpause');
|
|
971
|
+
var onPostUnpause = getOption(options, 'onPostUnpause');
|
|
972
|
+
onUnpause === null || onUnpause === undefined || onUnpause();
|
|
973
|
+
updateTabbableNodes();
|
|
974
|
+
addListeners();
|
|
975
|
+
updateObservedNodes();
|
|
976
|
+
onPostUnpause === null || onPostUnpause === undefined || onPostUnpause();
|
|
977
|
+
}
|
|
978
|
+
return this;
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
});
|
|
959
982
|
|
|
960
983
|
// initialize container elements
|
|
961
984
|
trap.updateContainerElements(elements);
|