Debian Codegraph @

node/focus-trap/CHANGELOG.md

raw
1 # Changelog
2
3 ## 7.6.6
4
5 ### Patch Changes
6
7 - dcd4ae9: Update `tabbable` dependency to [6.3.0](https://github.com/focus-trap/tabbable/blob/master/CHANGELOG.md#630) for new `displayCheck` option.
8
9 ## 7.6.5
10
11 ### Patch Changes
12
13 - d51ad78: Allow activation element in shadow DOM to be auto-focused after trap is deactivated
14
15 ## 7.6.4
16
17 ### Patch Changes
18
19 - bb47f7a: Remove engine requirement that crept into `package.json`. Sorry about that! ([#1343](https://github.com/focus-trap/focus-trap/issues/1343))
20
21 ## 7.6.3
22
23 ### Patch Changes
24
25 - 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.
26
27 ## 7.6.2
28
29 ### Patch Changes
30
31 - d4a4c34: Replace findIndex with native implementation - [Closes #1305](https://github.com/focus-trap/focus-trap/issues/1305
32
33 ## 7.6.1
34
35 ### Patch Changes
36
37 - fc5910d: Fix fallbackFocus not used when initialFocus is selector to non-existent node ([#1218](https://github.com/focus-trap/focus-trap/issues/1218))
38
39 ## 7.6.0
40
41 ### Minor Changes
42
43 - 8aeacee: Move `Escape` key handler to target phase to allow more control in `escapeDeactivates` ([#1247](https://github.com/focus-trap/focus-trap/issues/1247))
44
45 ## 7.5.4
46
47 ### Patch Changes
48
49 - 680f6e8: Fix issue with not being able to cycle back to the start from the last element if there is a focusable web component inside the focus-trap ((#1068)[https://github.com/focus-trap/focus-trap/issues/1068])
50
51 ## 7.5.3
52
53 ### Patch Changes
54
55 - 203b322: Fix missing typings for initialFocus option ([#1060](https://github.com/focus-trap/focus-trap/issues/1060))
56
57 ## 7.5.2
58
59 ### Patch Changes
60
61 - b73eb02: Remove references to `Array.prototype.findLast()` not well supported in Safari ([#996](https://github.com/focus-trap/focus-trap/issues/996))
62
63 ## 7.5.1
64
65 ### Patch Changes
66
67 - d9e2546: Fix possible exception in new `Tabbable.getTabIndex()` when initializing trap
68
69 ## 7.5.0
70
71 ### Minor Changes
72
73 - 5e2f913: Adds support for nodes with a positive tabindex in single-container traps only ([#375](https://github.com/focus-trap/focus-trap/issues/375))
74
75 ## 7.4.3
76
77 ### Patch Changes
78
79 - 134678b: Ensure focus is kept inside the trap when focused element is removed from the DOM ([focus-trap/focus-trap-react#962](https://github.com/focus-trap/focus-trap-react/issues/962))
80
81 ## 7.4.2
82
83 ### Patch Changes
84
85 - db62ce3: Clicking on open shadowDOM components within a focus trap's container when `clickOutsideDeactivates=true` should not deactivate the focus trap. ([#959](https://github.com/focus-trap/focus-trap/issues/959))
86
87 ## 7.4.1
88
89 ### Patch Changes
90
91 - 4f720ff: Bump tabbable to v6.1.2 for nwsapi patch
92
93 ## 7.4.0
94
95 ### Minor Changes
96
97 - da97007: Added new onPost/Pause and onPost/Unpause hooks when un/pausing a trap (also called when auto-un/paused as a result of de/activating a second trap while another is currently active). ([focus-trap-react#948](https://github.com/focus-trap/focus-trap-react/issues/948))
98
99 ## 7.3.1
100
101 ### Patch Changes
102
103 - a00cfa5: Bump tabbable to v6.1.1 for JSDom fixes
104
105 ## 7.3.0
106
107 ### Minor Changes
108
109 - ae7129d: Bump tabbable to v6.1.0 adding support for the new HTML `inert` attribute in browsers that support it (NOTE: FireFox does not support it at this time). Also fixes a bug. See tabbable CHANGELOG for more info.
110
111 ### Patch Changes
112
113 - a27ad58: Fix incorrect behavior of `returnFocusOnDeactivate` option when set to true (or defaulted to true) along with `clickOutsideDeactivates=true` and the outside click that deactivates is on a focusable node. Focus was remaining on that node instead of returning to the node focused just prior to activation. ([#893](https://github.com/focus-trap/focus-trap/issues/893))
114
115 ## 7.2.0
116
117 ### Minor Changes
118
119 - b0482af: Add new `isKeyForward()` and `isKeyBackward()` options ([#612](https://github.com/focus-trap/focus-trap/issues/612))
120
121 ## 7.1.0
122
123 ### Minor Changes
124
125 - 88cc9bc: Provide new `trapStack` option to make it possible to coordinate auto-activation/pausing between multiple `focus-trap` instances on the same page.
126
127 ### Patch Changes
128
129 - 4f97b38: Bump tabbable to v6.0.1 for a bug fix. See tabbable's changelog for more details.
130 - f13de76: Mention special Safari setting to enable normal DOM-based tab order in README. [#783](https://github.com/focus-trap/focus-trap/issues/783)
131
132 ## 7.0.0
133
134 ### Major Changes
135
136 - 5b64423: Revised and clarified official browser support (still as broad and deep as _reasonably_ possible).
137 - 47f62ac: 🚨 **Breaking:** Tabbable dependency has been updated to v6.0.0 and contains a breaking change related to detached nodes with its default `displayCheck` setting. See tabbable's [changelog](https://github.com/focus-trap/tabbable/blob/master/CHANGELOG.md#600) for more information.
138 - 5b64423: 🚨 **Breaking:** Dropped support of IE browsers, all versions.
139 - IE11 was [officially retired](https://blogs.windows.com/windowsexperience/2022/06/15/internet-explorer-11-has-retired-and-is-officially-out-of-support-what-you-need-to-know/) on June 15, 2022 (6 weeks ago). There are no longer any versions of IE that are still maintained or even supported by Microsoft.
140
141 ## 6.9.4
142
143 ### Patch Changes
144
145 - f68882e: Fix docs and typings to clarify that initialFocus, fallbackFocus, and setReturnFocus options can be functions that also return selector strings.
146
147 ## 6.9.3
148
149 ### Patch Changes
150
151 - 8a8b1f1: Bump tabbable to v5.3.3 to pick up a small bug fix to web component (shadow DOM) support.
152
153 ## 6.9.2
154
155 ### Patch Changes
156
157 - ef0ce48: Handle unexpected param (true) passed as the value for the `initialFocus`, `fallbackFocus`, and `setReturnFocus` options: Ignore and perform default behavior.
158
159 ## 6.9.1
160
161 ### Patch Changes
162
163 - 83262a7: Bumps tabbable to v5.3.2 to pick-up a fix to `displayCheck=full` (default) option behavior that caused issues with detached nodes.
164
165 ## 6.9.0
166
167 ### Minor Changes
168
169 - 2a57e4b: Add new `trap.active` and `trap.paused` readonly state properties on the trap so that the trap's active/paused state can be queried.
170
171 ### Patch Changes
172
173 - 8fd49df: Fixed bug where `clickOutsideDeactivate` handler would get called on the 'click' event even if the node clicked was in the trap. As with 'mousedown' and 'touchstart' events where this option is also used, the handler should only get called if the target node is _outside_ the trap.
174 - c32c60a: Fixed: onDeactivate, onPostDeactivate, and checkCanReturnFocus options originally given to createFocusTrap() were not being used by default when calling `trap.deactivate({...})` with an option set even if that option set didn't specify any overrides of these options.
175
176 ## 6.8.1
177
178 ### Patch Changes
179
180 - 7c86111:
181 - Bump tabbable to `^5.3.1` (fixing previous update which was incorrectly set to `5.3.0`).
182 - Fix `tabbableOptions` not being used in all internal uses of tabbable APIs.
183 - Expose `displayCheck` option in `tabbableOptions` typings and pass it through to tabbable APIs.
184 - Add info to README about testing traps in JSDom (which is not officially supported).
185
186 ## 6.8.0
187
188 ### Minor Changes
189
190 - 21458c9: Bumps tabbable to v5.3.0 and includes all changes from the past v6.8.0 beta releases. The big new feature is opt-in Shadow DOM support in tabbable, and a new `getShadowRoot` tabbable option exposed in a new `tabbableOptions` focus-trap config option.
191 - ⚠️ This will likely break your tests **if you're using JSDom** (e.g. with Jest). See [testing in JSDom](./README.md#testing-in-jsdom) for more info.
192
193 ## 6.8.0-beta.2
194
195 - When updating tabbable nodes, make sure that `getShadowRoot` tabbable option is also passed to `focusable()`.
196 - Fix bug where having a tabbable node inside a web component in the middle of a tab sequence would cause the tab key to seemingly stop working just before focus should move to it ((#643)[https://github.com/focus-trap/focus-trap/issues/643]).
197 - Bumps tabbable to `v5.3.0-beta.1`
198
199 ## 6.8.0-beta.1
200
201 - Previous beta didn't include new source. This one does.
202
203 ## 6.8.0-beta.0
204
205 - Adds new `tabbableOptions` configuration option, which allows specifically for the new `getShadowRoot` Tabbable configuration option: `focusTrap.createFocusTrap(rootElement, { tabbableOptions: { getShadowRoot: (node) => closedShadowRoot } })`, for example (where your code has the reference to `closedShadowRoot` previously created on `node` which Tabbable cannot find on its own).
206 - Bumps tabbable to `v5.3.0-beta.0`
207
208 ## 6.7.3
209
210 ### Patch Changes
211
212 - ab20d3d: Fix issue with focusing negative tabindex node and then tabbing away when this node is _not_ the last node in the trap's container ((#611)[https://github.com/focus-trap/focus-trap/issues/611])
213
214 ## 6.7.2
215
216 ### Patch Changes
217
218 - c932330: Fixed bug where tabbing forward from an element with negative tabindex that is last in the trap would result in focus remaining on that element ([565](https://github.com/focus-trap/focus-trap/issues/565))
219
220 ## 6.7.1
221
222 ### Patch Changes
223
224 - 28a069f: Fix bug from #504 where it's no longer possible to create a trap without any options [#525]
225
226 ## 6.7.0
227
228 ### Minor Changes
229
230 - 893dd2c: Add `document` option to support focus traps inside `<iframe>` elements (#97)
231 - 244f0c1: Extend the `setReturnFocus` option to receive a reference to the element that had focus prior to the trap being activated when a function is specified. Additionally, the function can now return `false` to leave focus where it is at the time of deactivation. (#485)
232
233 ### Patch Changes
234
235 - 60162eb: Fix bug where `KeyboardEvent` was not being passed to `escapeDeactivates` option when it's a function (#498)
236 - 7b6abfa: Fix how focus-trap determines the event's target, which was preventing traps inside open shadow DOMs from working properly (#496)
237 - 14b0ee8: Fix `initialFocus` option not supporting function returning `false` as documented (#490)
238
239 ## 6.6.1
240
241 ### Patch Changes
242
243 - 24063d7: Update tabbable to v5.2.1 to get bug fix for disabled fieldsets.
244
245 ## 6.6.0
246
247 ### Minor Changes
248
249 - 281e66c: Add option to allow no initial focus when trap activates via `initialFocus: false`
250
251 There may be cases where we don't want to focus the first tabbable element when a focus trap activates.
252
253 Examples use-cases:
254 - Modals/dialogs
255 - On mobile devices where "tabbing" doesn't make sense without a connected Bluetooth keyboard
256
257 In addition, this change ensures that any element inside the trap manually focused outside of `focus-trap` code will be brought back in focus if focus is somehow found outside of the trap.
258
259 Example usage:
260
261 When the trap activates, there will be no initially focused element inside the new trap.
262
263 ```js
264 const focusTrap = createFocusTrap('#some-container', {
265 initialFocus: false,
266 });
267 ```
268
269 - 75be463: `escapeDeactivates` can now be either a boolean (as before) or a function that takes an event and returns a boolean.
270
271 ### Patch Changes
272
273 - e2294f0: Fix race condition when activating a second trap where initial focus in the second trap may be thwarted because pausing of first trap clears the `delayInitialFocus` timer created for the second trap before during its activation sequence.
274
275 ## 6.5.1
276
277 ### Patch Changes
278
279 - c38bf3f: onPostDeactivate should always be called even if returnFocus/OnDeactivate is disabled.
280
281 ## 6.5.0
282
283 ### Minor Changes
284
285 - 278e77e: Adding 4 new configuration event options to improve support for animated dialogs and animated focus trap triggers: `checkCanFocusTrap()`, `onPostActivate()`, `checkCanReturnFocus()`, and `onPostDeactivate()`.
286
287 ### Patch Changes
288
289 - 8d11e15: Improve docs and types for most options, adding `SVGElement` as a supported type of "DOM node" since it supports the `focus()` method, same as `HTMLElement`.
290
291 ## 6.4.0
292
293 ### Minor Changes
294
295 - 21c82ce: Bump tabbable from 5.1.6 to 5.2.0. There should be no changes in behavior as a result of this upgrade as `focus-trap` does not currently leverage the new `displayCheck` option.
296
297 ### Patch Changes
298
299 - 1baf62e: Fix focus trapped on initial focus container with tabindex=-1 when pressing shift+tab (#363)
300
301 ## 6.3.0
302
303 ### Minor Changes
304
305 - a882d62: `clickOutsideDeactivates` can now also be a function that returns a `boolean`, similar to `allowOutsideClick`. The function receives the `MouseEvent` that triggered the click. (#289)
306
307 ### Patch Changes
308
309 - 4d67dee: Fix a focus escape when pressing TAB after hiding element with focus (#281)
310 - ca32014: Bump tabbable from 5.1.4 to 5.1.5
311
312 ## 6.2.3
313
314 ### Patch Changes
315
316 - 036a72e: Fix crash in IE due to use of `Array.findIndex()` not supported in that browser (#257)
317
318 ## 6.2.2
319
320 ### Patch Changes
321
322 - fd3f2d1: Fix a bug where a multi-container trap would cease to work if all tabbable nodes were removed from one of the containers (fixes #223). As a result, an error is now thrown if the trap is left in a state where none of its containers contain any tabbable nodes (unless a `fallbackFocus` node has been configured in the trap's options). Also, the most-recently-focused node is more reliably tracked now, should focus somehow escape the trap and be brought back in by the trap, resulting in the truly most-recently-focused node to regain focus if that ever happens.
323
324 ## 6.2.1
325
326 ### Patch Changes
327
328 - f0c2aff: Bump tabbable to [5.1.4](https://github.com/focus-trap/tabbable/blob/master/CHANGELOG.md#514) for bug fix.
329 - 2ba512b:
330 - Refactored code to use function declarations instead of hoisted functions (this should have no bearing on functionality in the build output included in `./dist`.
331 - Fixed bugs where `trap.activate()` and `trap.deactivate()` would not always return the trap (now they do in all circumstances).
332 - d26d2e1: Refactoring to use const/let, and simplify a few lines. This does NOT impact the build output published in `./dist`, however, and hence does not impact browser support.
333
334 ## 6.2.0
335
336 ### Minor Changes
337
338 - 2267d17: Adding support for multiple elements to be passed in #217
339
340 ## 6.1.4
341
342 ### Patch Changes
343
344 - 38b6b98: Update tabbable to [5.1.3](https://github.com/focus-trap/tabbable/blob/master/CHANGELOG.md#513) to get bug fixes related to detail and summary elements.
345
346 ## 6.1.3
347
348 ### Patch Changes
349
350 - 6a39217: Close the gap with #172 and bump `tabbable` to 5.1.2 which has a similar fix.
351 - 756c79d: Fix #172 (again): Transpile ESM bundle down to the same browser target used for the CJS and UMD bundles. ESM is just the module system, not the browser target.
352
353 ## 6.1.2
354
355 ### Patch Changes
356
357 - 00674dd: Fix #172: Transpile non-minified bundles so they are compatible with IE11.
358 - 679009b: Update tabbable dependency to 5.1.1 to get transpiled non-minified bundles.
359
360 ## 6.1.1
361
362 ### Patch Changes
363
364 - fe2b0ad: Fixed #103: `returnFocusOnDeactivate` is now respected on auto-deactivation with `clickOutsideDeactivates=true`.
365
366 ## 6.1.0
367
368 ### Minor Changes
369
370 - 5174ce1: Add delayInitialFocus option
371
372 ### Patch Changes
373
374 - 53b906b: Change `prepublishOnly` script to `prepare` script so that it also runs if someone installs the package directly from the git repo (e.g. from your work in which you fixed a bug or added a feature you're waiting to get merged to master and published to NPM).
375 - 31bb28e: Update tabbable dependency to 5.1.0. The most significant update for focus-trap is a bug fix related to fixed-position containers.
376
377 ## 6.0.1
378
379 ### Patch Changes
380
381 - 694e2fa: Package main/module entries no longer point to minified bundles.
382
383 ## 6.0.0
384
385 - Add boolean value support for `allowOutsideClick` option.
386 - New `preventScroll` feature to _prevent_ scrolling to the element getting focus if not in the viewport.
387 - Changed code formatting to use dangling commas where ES5 supports them.
388 - **BREAKING**: Updated [tabbable](https://github.com/focus-trap/tabbable/blob/master/CHANGELOG.md#500) dependency to the new 5.0.0 release which contains breaking changes to its `isTabbableRadio()` internal function.
389 - Help with tree shaking by having `package.json` state `sideEffects: false` to mark this module as having no side effects as a result of merely importing it.
390 - **BREAKING**: This `package.json`'s "main" no longer points to `./index.js` in the package (although it still points to a CJS module, so it's possible this actually doesn't break anything). It now has:
391 - "main": `dist/focus-trap.min.js` (the CJS bundle)
392 - "module": `dist/focus-trap.esm.min.js` (the **new ESM bundle**)
393 - the UMD is `dist/focus-trap.umd.min.js` if needed (convenient for loading directly in an older browser that doesn't support ESM)
394 - **NOTE:** The CJS build no longer provides a function as a default export. Use `const { createFocusTrap } = require('focus-trap');` to get the function from before.
395 - **NOTE:** The ESM build does not provide a default export. Use `import { createFocusTrap } from 'focus-trap';` to import the module.
396 - **New ESM Build**: Included in `dist/focus-trap.esm.*`.
397 - New UMD Build: Included in `dist/focus-trap.umd.*`.
398
399 ## 5.1.0
400
401 - Add `setReturnFocus` option that allows you to set which element receives focus when the trap closes.
402
403 ## 5.0.2
404
405 - Add `allowOutsideClick` option that allows you to pass a click event through, even when `clickOutsideDeactivates` is `false`.
406
407 ## 5.0.0
408
409 - Update Tabbable to improve performance (see [Tabbable's changelog](https://github.com/davidtheclark/tabbable/blob/master/CHANGELOG.md)).
410 - **Breaking (kind of):** if the `onActivate` callback changes the list of tabbable nodes and the `initialFocus` option is not used, the initial focus will still go to the first element present before the callback.
411 - Improve performance of activating a trap.
412 - Register document-level event listeners as active (`passive: false`).
413
414 ## 4.0.2
415
416 - Fix reference to root element that caused errors within Shadow DOM.
417
418 (Release 4.0.1 was a mistake, containing no changes.)
419
420 ## 4.0.0
421
422 - **Breaking (kind of):** Focus trap now manages a queue of traps, so when a trap is paused because another trap activates, it will be unpaused when that other trap deactivates. If Trap A was automatically _paused_ because Trap B activated (existing behavior), when Trap B is deactivated Trap A will be automatically _unpaused_ (new behavior).
423
424 ## 3.0.0
425
426 - **Breaking (kind of):** Update Tabbable to detect more elements and be more careful with radio buttons (see [Tabbable's changelog](https://github.com/davidtheclark/tabbable/blob/master/CHANGELOG.md)).
427 - **Breaking (kind of):** If `clickOutsideDeactivates` and `returnFocusOnDeactivate` are both `true`, focus will be returned to the pre-trap element only if the clicked element is not focusable.
428
429 ## 2.4.6
430
431 - Add slight delay before moving focus to the first element in the trap. This should prevent an occasional bug caused when the first element in the trap will close the trap if it picks up on the event that triggered the trap's opening.
432
433 ## 2.4.5
434
435 - Fix `"main"` field in `package.json`.
436
437 ## 2.4.4
438
439 - Publish UMD build so people can download it from `unpkg.com`.
440
441 ## 2.4.3
442
443 - Fixed: TypeScript signature for `activate` function.
444
445 ## 2.4.2
446
447 - Added: TypeScript declaration file.
448
449 ## 2.3.1
450
451 - Fixed: Activation does not re-focus already-focused node.
452 - Fixed: Tabbing works as expected when initially focused Node has a negative `tabindex` and is in the middle of other tabbable elements.
453
454 ## 2.3.0
455
456 - Added: `initialFocus` and `fallbackFocus` options can take functions that return DOM nodes.
457 - Fixed: `pause` and `unpause` cannot accidentally add extra event listeners.
458
459 ## 2.2.0
460
461 - Added/fixed, depending on your perspective: If focus is already inside the focus trap when it is activated, leave focus where it is instead of forcing it to the first tabbable node or `initialFocus`.
462
463 ## 2.1.0
464
465 - Added: `fallbackFocus` option.
466
467 ## 2.0.2
468
469 - Fixed: `clickOutsideDeactivates` no longer triggers deactivation when you click _inside_ the trap.
470
471 ## 2.0.1
472
473 - Fix bug when activating multiple focus traps.
474
475 ## 2.0.0
476
477 - Rewrote the thing, altering the API. Read the new docs please.
478 - Update `tabbable` to fix handling of traps with changing contents.
479
480 ## 1.1.1
481
482 - Improve `clickOutsideDeactivates` functionality.
483
484 ## 1.1.0
485
486 - Add `clickOutsideDeactivates` option.
487 - Add `escapeDeactivates` option.
488
489 ## 1.0.2
490
491 - Make sure to `select()` `<input>` elements when they receive focus via tab.
492
493 ## 1.0.1
494
495 - Fix buggy attempts to focus nodes that don't exist.
496
497 ## 1.0.0
498
499 - Initial release.