focus-trap 7.6.1 β 7.6.3
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 +7 -5
- package/dist/focus-trap.esm.js +70 -61
- 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 +69 -60
- 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 +69 -60
- 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 +58 -46
- package/package.json +31 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 7.6.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 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.
|
|
8
|
+
|
|
9
|
+
## 7.6.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- d4a4c34: Replace findIndex with native implementation - [Closes #1305](https://github.com/focus-trap/focus-trap/issues/1305
|
|
14
|
+
|
|
3
15
|
## 7.6.1
|
|
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.
|
|
@@ -379,44 +379,46 @@ In alphabetical order:
|
|
|
379
379
|
<tr>
|
|
380
380
|
<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
381
|
<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>
|
|
382
|
+
<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>
|
|
382
383
|
<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
384
|
<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
385
|
<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
386
|
<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
387
|
</tr>
|
|
388
388
|
<tr>
|
|
389
|
+
<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
390
|
<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
391
|
<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
392
|
<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
393
|
<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
394
|
<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
395
|
<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
396
|
</tr>
|
|
397
397
|
<tr>
|
|
398
|
+
<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
399
|
<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
400
|
<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
401
|
<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
402
|
<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
403
|
<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
404
|
<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
405
|
</tr>
|
|
406
406
|
<tr>
|
|
407
|
+
<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
408
|
<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
409
|
<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
410
|
<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
411
|
<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
412
|
<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
413
|
<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
414
|
</tr>
|
|
415
415
|
<tr>
|
|
416
|
+
<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
417
|
<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
418
|
<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
419
|
<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
420
|
<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>
|
|
421
|
+
<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>
|
|
420
422
|
<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>
|
|
421
423
|
</tr>
|
|
422
424
|
</tbody>
|
package/dist/focus-trap.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* focus-trap 7.6.
|
|
2
|
+
* focus-trap 7.6.3
|
|
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
|
|
@@ -122,20 +122,6 @@ var delay = function delay(fn) {
|
|
|
122
122
|
return setTimeout(fn, 0);
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
-
// Array.find/findIndex() are not supported on IE; this replicates enough
|
|
126
|
-
// of Array.findIndex() for our needs
|
|
127
|
-
var findIndex = function findIndex(arr, fn) {
|
|
128
|
-
var idx = -1;
|
|
129
|
-
arr.every(function (value, i) {
|
|
130
|
-
if (fn(value)) {
|
|
131
|
-
idx = i;
|
|
132
|
-
return false; // break
|
|
133
|
-
}
|
|
134
|
-
return true; // next
|
|
135
|
-
});
|
|
136
|
-
return idx;
|
|
137
|
-
};
|
|
138
|
-
|
|
139
125
|
/**
|
|
140
126
|
* Get an option's value when it could be a plain value, or a handler that provides
|
|
141
127
|
* the value.
|
|
@@ -147,7 +133,7 @@ var valueOrHandler = function valueOrHandler(value) {
|
|
|
147
133
|
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
148
134
|
params[_key - 1] = arguments[_key];
|
|
149
135
|
}
|
|
150
|
-
return typeof value === 'function' ? value.apply(
|
|
136
|
+
return typeof value === 'function' ? value.apply(undefined, params) : value;
|
|
151
137
|
};
|
|
152
138
|
var getActualTarget = function getActualTarget(event) {
|
|
153
139
|
// NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
|
|
@@ -166,8 +152,8 @@ var internalTrapStack = [];
|
|
|
166
152
|
var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
167
153
|
// SSR: a live trap shouldn't be created in this type of environment so this
|
|
168
154
|
// should be safe code to execute if the `document` option isn't specified
|
|
169
|
-
var doc = (userOptions === null || userOptions ===
|
|
170
|
-
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;
|
|
171
157
|
var config = _objectSpread2({
|
|
172
158
|
returnFocusOnDeactivate: true,
|
|
173
159
|
escapeDeactivates: true,
|
|
@@ -207,6 +193,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
207
193
|
mostRecentlyFocusedNode: null,
|
|
208
194
|
active: false,
|
|
209
195
|
paused: false,
|
|
196
|
+
manuallyPaused: false,
|
|
210
197
|
// timer ID for when delayInitialFocus is true and initial focus in this trap
|
|
211
198
|
// has been delayed during activation
|
|
212
199
|
delayInitialFocusTimer: undefined,
|
|
@@ -238,7 +225,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
238
225
|
* if the element isn't found.
|
|
239
226
|
*/
|
|
240
227
|
var findContainerIndex = function findContainerIndex(element, event) {
|
|
241
|
-
var composedPath = typeof (event === null || event ===
|
|
228
|
+
var composedPath = typeof (event === null || event === undefined ? undefined : event.composedPath) === 'function' ? event.composedPath() : undefined;
|
|
242
229
|
// NOTE: search `containerGroups` because it's possible a group contains no tabbable
|
|
243
230
|
// nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
|
|
244
231
|
// and we still need to find the element in there
|
|
@@ -249,7 +236,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
249
236
|
// web components if the `tabbableOptions.getShadowRoot` option was used for
|
|
250
237
|
// the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
|
|
251
238
|
// look inside web components even if open)
|
|
252
|
-
composedPath === null || composedPath ===
|
|
239
|
+
composedPath === null || composedPath === undefined ? undefined : composedPath.includes(container)) || tabbableNodes.find(function (node) {
|
|
253
240
|
return node === element;
|
|
254
241
|
});
|
|
255
242
|
});
|
|
@@ -276,12 +263,12 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
276
263
|
var getNodeForOption = function getNodeForOption(optionName) {
|
|
277
264
|
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
278
265
|
_ref2$hasFallback = _ref2.hasFallback,
|
|
279
|
-
hasFallback = _ref2$hasFallback ===
|
|
266
|
+
hasFallback = _ref2$hasFallback === undefined ? false : _ref2$hasFallback,
|
|
280
267
|
_ref2$params = _ref2.params,
|
|
281
|
-
params = _ref2$params ===
|
|
268
|
+
params = _ref2$params === undefined ? [] : _ref2$params;
|
|
282
269
|
var optionValue = config[optionName];
|
|
283
270
|
if (typeof optionValue === 'function') {
|
|
284
|
-
optionValue = optionValue.apply(
|
|
271
|
+
optionValue = optionValue.apply(undefined, _toConsumableArray(params));
|
|
285
272
|
}
|
|
286
273
|
if (optionValue === true) {
|
|
287
274
|
optionValue = undefined; // use default value
|
|
@@ -497,7 +484,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
497
484
|
var target = _ref3.target,
|
|
498
485
|
event = _ref3.event,
|
|
499
486
|
_ref3$isBackward = _ref3.isBackward,
|
|
500
|
-
isBackward = _ref3$isBackward ===
|
|
487
|
+
isBackward = _ref3$isBackward === undefined ? false : _ref3$isBackward;
|
|
501
488
|
target = target || getActualTarget(event);
|
|
502
489
|
updateTabbableNodes();
|
|
503
490
|
var destinationNode = null;
|
|
@@ -521,7 +508,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
521
508
|
// REVERSE
|
|
522
509
|
|
|
523
510
|
// is the target the first tabbable node in a group?
|
|
524
|
-
var startOfGroupIndex =
|
|
511
|
+
var startOfGroupIndex = state.tabbableGroups.findIndex(function (_ref4) {
|
|
525
512
|
var firstTabbableNode = _ref4.firstTabbableNode;
|
|
526
513
|
return target === firstTabbableNode;
|
|
527
514
|
});
|
|
@@ -550,7 +537,7 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
550
537
|
// FORWARD
|
|
551
538
|
|
|
552
539
|
// is the target the last tabbable node in a group?
|
|
553
|
-
var lastOfGroupIndex =
|
|
540
|
+
var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref5) {
|
|
554
541
|
var lastTabbableNode = _ref5.lastTabbableNode;
|
|
555
542
|
return target === lastTabbableNode;
|
|
556
543
|
});
|
|
@@ -879,14 +866,14 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
879
866
|
state.active = true;
|
|
880
867
|
state.paused = false;
|
|
881
868
|
state.nodeFocusedBeforeActivation = doc.activeElement;
|
|
882
|
-
onActivate === null || onActivate ===
|
|
869
|
+
onActivate === null || onActivate === undefined || onActivate();
|
|
883
870
|
var finishActivation = function finishActivation() {
|
|
884
871
|
if (checkCanFocusTrap) {
|
|
885
872
|
updateTabbableNodes();
|
|
886
873
|
}
|
|
887
874
|
addListeners();
|
|
888
875
|
updateObservedNodes();
|
|
889
|
-
onPostActivate === null || onPostActivate ===
|
|
876
|
+
onPostActivate === null || onPostActivate === undefined || onPostActivate();
|
|
890
877
|
};
|
|
891
878
|
if (checkCanFocusTrap) {
|
|
892
879
|
checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
|
|
@@ -915,13 +902,13 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
915
902
|
var onPostDeactivate = getOption(options, 'onPostDeactivate');
|
|
916
903
|
var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
|
|
917
904
|
var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
|
|
918
|
-
onDeactivate === null || onDeactivate ===
|
|
905
|
+
onDeactivate === null || onDeactivate === undefined || onDeactivate();
|
|
919
906
|
var finishDeactivation = function finishDeactivation() {
|
|
920
907
|
delay(function () {
|
|
921
908
|
if (returnFocus) {
|
|
922
909
|
_tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
|
|
923
910
|
}
|
|
924
|
-
onPostDeactivate === null || onPostDeactivate ===
|
|
911
|
+
onPostDeactivate === null || onPostDeactivate === undefined || onPostDeactivate();
|
|
925
912
|
});
|
|
926
913
|
};
|
|
927
914
|
if (returnFocus && checkCanReturnFocus) {
|
|
@@ -932,31 +919,21 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
932
919
|
return this;
|
|
933
920
|
},
|
|
934
921
|
pause: function pause(pauseOptions) {
|
|
935
|
-
if (
|
|
922
|
+
if (!state.active) {
|
|
936
923
|
return this;
|
|
937
924
|
}
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
state.paused = true;
|
|
941
|
-
onPause === null || onPause === void 0 || onPause();
|
|
942
|
-
removeListeners();
|
|
943
|
-
updateObservedNodes();
|
|
944
|
-
onPostPause === null || onPostPause === void 0 || onPostPause();
|
|
945
|
-
return this;
|
|
925
|
+
state.manuallyPaused = true;
|
|
926
|
+
return this._setPausedState(true, pauseOptions);
|
|
946
927
|
},
|
|
947
928
|
unpause: function unpause(unpauseOptions) {
|
|
948
|
-
if (!state.
|
|
929
|
+
if (!state.active) {
|
|
949
930
|
return this;
|
|
950
931
|
}
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
addListeners();
|
|
957
|
-
updateObservedNodes();
|
|
958
|
-
onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
|
|
959
|
-
return this;
|
|
932
|
+
state.manuallyPaused = false;
|
|
933
|
+
if (trapStack[trapStack.length - 1] !== this) {
|
|
934
|
+
return this;
|
|
935
|
+
}
|
|
936
|
+
return this._setPausedState(false, unpauseOptions);
|
|
960
937
|
},
|
|
961
938
|
updateContainerElements: function updateContainerElements(containerElements) {
|
|
962
939
|
var elementsAsArray = [].concat(containerElements).filter(Boolean);
|
|
@@ -970,6 +947,38 @@ var createFocusTrap = function createFocusTrap(elements, userOptions) {
|
|
|
970
947
|
return this;
|
|
971
948
|
}
|
|
972
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
|
+
});
|
|
973
982
|
|
|
974
983
|
// initialize container elements
|
|
975
984
|
trap.updateContainerElements(elements);
|