diff --git a/.changeset/clean-buttons-jog.md b/.changeset/clean-buttons-jog.md deleted file mode 100644 index 196acab7..00000000 --- a/.changeset/clean-buttons-jog.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Remove possibility to provide `escape` as a function. - -It is unnecessary, as the user of the library can easily listen for `Esc` key presses by themselves. - -As a side note, the implementation of the previous behaviour was buggy. diff --git a/.changeset/cool-islands-own.md b/.changeset/cool-islands-own.md deleted file mode 100644 index 30ad4d3c..00000000 --- a/.changeset/cool-islands-own.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Fix logic to "normalise" `returnFocus` in normalise.ts - -The default `document.activeElement` was not given in case `returnFocus` was `undefined` or a string not corresponding to any ID in the DOM. -It was given only when `returnFocus === true`. diff --git a/.changeset/good-bugs-hear.md b/.changeset/good-bugs-hear.md deleted file mode 100644 index 98fb5e43..00000000 --- a/.changeset/good-bugs-hear.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Fix algorithm to find a destination for the focus. - -When (during in the context of a Tab key press happening) `event.target` has a tab index of zero, the library should switch from looking for the next zero tabbable to look for a positive tabbable whenever `event.target` **is** or **precedes/follows** the **first/last zero tabbable in the whole focus trap**. - -Before the fix, the switch in search would have happened only if `event.target` **was contained in** or **preceded/followed** the **first/last root in the focus-trap**. diff --git a/.changeset/lazy-gorillas-whisper.md b/.changeset/lazy-gorillas-whisper.md deleted file mode 100644 index 30eef987..00000000 --- a/.changeset/lazy-gorillas-whisper.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'demo': patch ---- - -Fix "change" handlers for `` components in TrapControls.tsx - -They were using a potentially out of date state. -In the process some typings have changed. diff --git a/.changeset/pretty-wombats-switch.md b/.changeset/pretty-wombats-switch.md deleted file mode 100644 index 143e16d2..00000000 --- a/.changeset/pretty-wombats-switch.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Remove custom type annotation for `Array.prototype.findLast`. - -It is now buit-in since TypeScript v5.0 (https://github.com/microsoft/TypeScript/issues/48829#issuecomment-1442649966). diff --git a/.changeset/rare-carpets-change.md b/.changeset/rare-carpets-change.md deleted file mode 100644 index e2164f95..00000000 --- a/.changeset/rare-carpets-change.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Fix `demolish` logic in trap-actions.ts - -`state.isBuilt` was set to `false` before calling `pause` and the focus trap was therefore left up and running (while an error would be thrown, saying _"Cannot pause inexistent trap"_ ). diff --git a/.changeset/tricky-singers-act.md b/.changeset/tricky-singers-act.md deleted file mode 100644 index 052ba270..00000000 --- a/.changeset/tricky-singers-act.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Export types diff --git a/.changeset/warm-moles-share.md b/.changeset/warm-moles-share.md deleted file mode 100644 index 71c980fa..00000000 --- a/.changeset/warm-moles-share.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@davidevmod/focus-trap': patch ---- - -Fix inefficient code in destination.ts diff --git a/apps/demo/CHANGELOG.md b/apps/demo/CHANGELOG.md new file mode 100644 index 00000000..d7f97dec --- /dev/null +++ b/apps/demo/CHANGELOG.md @@ -0,0 +1,13 @@ +# demo + +## 0.1.4 + +### Patch Changes + +- [`713aabc`](https://github.com/DaviDevMod/focus-trap/commit/713aabc0fb781068a559cf287105f1d0c5e10f1f) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Fix "change" handlers for `` components in TrapControls.tsx + + They were using a potentially out of date state. + In the process some typings have changed. + +- Updated dependencies [[`2c17880`](https://github.com/DaviDevMod/focus-trap/commit/2c17880cdb4364afeec490a0f1ec39c49eaf54df), [`d95f7df`](https://github.com/DaviDevMod/focus-trap/commit/d95f7df5e2547a7b5ca4fe906e8c153f8e224c5f), [`fd6cf73`](https://github.com/DaviDevMod/focus-trap/commit/fd6cf73d6cad7b31f8bd73dfabde63473c061022), [`2c5bd1c`](https://github.com/DaviDevMod/focus-trap/commit/2c5bd1c2ae4b7cf8a242f064d0da1555085c8b5a), [`0d154e8`](https://github.com/DaviDevMod/focus-trap/commit/0d154e84db7648a99ff395c739ca39f1a8e0343e), [`0d90cba`](https://github.com/DaviDevMod/focus-trap/commit/0d90cba8dcb7e3a7f73a8d1376950886ec7dfb35), [`79b0e44`](https://github.com/DaviDevMod/focus-trap/commit/79b0e4421c2846396a8d3cd49c37407007751211)]: + - @davidevmod/focus-trap@0.0.2 diff --git a/apps/demo/package.json b/apps/demo/package.json index 46b538e3..d78de029 100644 --- a/apps/demo/package.json +++ b/apps/demo/package.json @@ -1,6 +1,6 @@ { "name": "demo", - "version": "0.1.3", + "version": "0.1.4", "private": true, "scripts": { "dev": "next dev", diff --git a/packages/focus-trap/CHANGELOG.md b/packages/focus-trap/CHANGELOG.md new file mode 100644 index 00000000..2324cee2 --- /dev/null +++ b/packages/focus-trap/CHANGELOG.md @@ -0,0 +1,34 @@ +# @davidevmod/focus-trap + +## 0.0.2 + +### Patch Changes + +- [`2c17880`](https://github.com/DaviDevMod/focus-trap/commit/2c17880cdb4364afeec490a0f1ec39c49eaf54df) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Remove possibility to provide `escape` as a function. + + It is unnecessary, as the user of the library can easily listen for `Esc` key presses by themselves. + + As a side note, the implementation of the previous behaviour was buggy. + +- [`d95f7df`](https://github.com/DaviDevMod/focus-trap/commit/d95f7df5e2547a7b5ca4fe906e8c153f8e224c5f) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Fix logic to "normalise" `returnFocus` in normalise.ts + + The default `document.activeElement` was not given in case `returnFocus` was `undefined` or a string not corresponding to any ID in the DOM. + It was given only when `returnFocus === true`. + +- [`fd6cf73`](https://github.com/DaviDevMod/focus-trap/commit/fd6cf73d6cad7b31f8bd73dfabde63473c061022) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Fix algorithm to find a destination for the focus. + + When (during in the context of a Tab key press happening) `event.target` has a tab index of zero, the library should switch from looking for the next zero tabbable to look for a positive tabbable whenever `event.target` **is** or **precedes/follows** the **first/last zero tabbable in the whole focus trap**. + + Before the fix, the switch in search would have happened only if `event.target` **was contained in** or **preceded/followed** the **first/last root in the focus-trap**. + +- [`2c5bd1c`](https://github.com/DaviDevMod/focus-trap/commit/2c5bd1c2ae4b7cf8a242f064d0da1555085c8b5a) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Remove custom type annotation for `Array.prototype.findLast`. + + It is now buit-in since TypeScript v5.0 (https://github.com/microsoft/TypeScript/issues/48829#issuecomment-1442649966). + +- [`0d154e8`](https://github.com/DaviDevMod/focus-trap/commit/0d154e84db7648a99ff395c739ca39f1a8e0343e) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Fix `demolish` logic in trap-actions.ts + + `state.isBuilt` was set to `false` before calling `pause` and the focus trap was therefore left up and running (while an error would be thrown, saying _"Cannot pause inexistent trap"_ ). + +- [`0d90cba`](https://github.com/DaviDevMod/focus-trap/commit/0d90cba8dcb7e3a7f73a8d1376950886ec7dfb35) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Export types + +- [`79b0e44`](https://github.com/DaviDevMod/focus-trap/commit/79b0e4421c2846396a8d3cd49c37407007751211) Thanks [@DaviDevMod](https://github.com/DaviDevMod)! - Fix inefficient code in destination.ts diff --git a/packages/focus-trap/package.json b/packages/focus-trap/package.json index 9d91839f..d3522419 100644 --- a/packages/focus-trap/package.json +++ b/packages/focus-trap/package.json @@ -1,6 +1,6 @@ { "name": "@davidevmod/focus-trap", - "version": "0.0.1", + "version": "0.0.2", "license": "MIT", "repository": "https://github.com/DaviDevMod/focus-trap/tree/main/packages/focus-trap", "type": "module",