From 35e7cbb37580c7ac7b54bbc2ea8ebbe1f62f3aa7 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 8 May 2024 12:55:27 +0200 Subject: [PATCH 01/14] sync with `1.x` branch --- packages/@headlessui-vue/CHANGELOG.md | 15 +++++++++++++-- packages/@headlessui-vue/package.json | 2 +- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/packages/@headlessui-vue/CHANGELOG.md b/packages/@headlessui-vue/CHANGELOG.md index 4c089a76b5..9c23c27551 100644 --- a/packages/@headlessui-vue/CHANGELOG.md +++ b/packages/@headlessui-vue/CHANGELOG.md @@ -12,11 +12,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add `immediate` prop to `` for immediately opening the Combobox when the `input` receives focus ([#2686](https://github.com/tailwindlabs/headlessui/pull/2686)) - Add `virtual` prop to `Combobox` component ([#2779](https://github.com/tailwindlabs/headlessui/pull/2779)) +## [1.7.22] - 2024-05-08 + ### Fixed -- Prevent closing the `Combobox` component when clicking inside the scrollbar area ([#3104](https://github.com/tailwindlabs/headlessui/pull/3104)) +- Don’t cancel `touchmove` on `input` elements inside a dialog ([#3166](https://github.com/tailwindlabs/headlessui/pull/3166)) - Ensure clicking a `ComboboxOption` after filtering the options, correctly triggers a change ([#3180](https://github.com/tailwindlabs/headlessui/pull/3180)) +## [1.7.21] - 2024-04-26 + +### Fixed + +- Prevent closing the `Combobox` component when clicking inside the scrollbar area ([#3104](https://github.com/tailwindlabs/headlessui/pull/3104)) +- Don’t unmount portal targets used by other portals ([#3144](https://github.com/tailwindlabs/headlessui/pull/3144)) + ## [1.7.20] - 2024-04-15 ### Fixed @@ -533,7 +542,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Everything! -[unreleased]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vue@v1.7.20...HEAD +[unreleased]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vu@v1.7.22...HEAD +[1.7.22]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vue@v1.7.21...@headlessui/vue@v1.7.22 +[1.7.21]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vue@v1.7.20...@headlessui/vue@v1.7.21 [1.7.20]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vue@v1.7.19...@headlessui/vue@v1.7.20 [1.7.19]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vue@v1.7.18...@headlessui/vue@v1.7.19 [1.7.18]: https://github.com/tailwindlabs/headlessui/compare/@headlessui/vue@v1.7.17...@headlessui/vue@v1.7.18 diff --git a/packages/@headlessui-vue/package.json b/packages/@headlessui-vue/package.json index 42eb1b4824..0dd685ecc0 100644 --- a/packages/@headlessui-vue/package.json +++ b/packages/@headlessui-vue/package.json @@ -1,6 +1,6 @@ { "name": "@headlessui/vue", - "version": "1.7.16", + "version": "1.7.22", "description": "A set of completely unstyled, fully accessible UI components for Vue 3, designed to integrate beautifully with Tailwind CSS.", "main": "dist/index.cjs", "typings": "dist/index.d.ts", From 031b39d52259c81b9906d86ec7118755da6ef916 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 8 May 2024 13:35:04 +0200 Subject: [PATCH 02/14] update @headlessui/vue version in package-lock.json --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 2745db8226..3f3fcc082e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10724,7 +10724,7 @@ }, "packages/@headlessui-vue": { "name": "@headlessui/vue", - "version": "1.7.16", + "version": "1.7.22", "license": "MIT", "dependencies": { "@tanstack/vue-virtual": "3.0.0-beta.60" From 4eff138adab53b9e063a911b5d7115a9891b0544 Mon Sep 17 00:00:00 2001 From: Jordan Pittman Date: Fri, 10 May 2024 14:55:17 -0400 Subject: [PATCH 03/14] =?UTF-8?q?Don=E2=80=99t=20set=20a=20focus=20fallbac?= =?UTF-8?q?k=20for=20Dialog=E2=80=99s=20in=20demo=20mode=20(#3194)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Don’t set a focus fallback for Dialog’s in demo mode * Update changelog --- packages/@headlessui-react/CHANGELOG.md | 4 +++- packages/@headlessui-react/src/components/dialog/dialog.tsx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index eaed7a3a4a..952035f4e6 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -- Nothing yet! +### Fixed + +- [internal] Don’t set a focus fallback for Dialog’s in demo mode ([#3194](https://github.com/tailwindlabs/headlessui/pull/3194)) ## [2.0.3] - 2024-05-07 diff --git a/packages/@headlessui-react/src/components/dialog/dialog.tsx b/packages/@headlessui-react/src/components/dialog/dialog.tsx index fd2f5f0f36..958fab3748 100644 --- a/packages/@headlessui-react/src/components/dialog/dialog.tsx +++ b/packages/@headlessui-react/src/components/dialog/dialog.tsx @@ -393,7 +393,7 @@ function DialogFn( From ea65164e663aa7d4c92aad3697e1f553960a3675 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Mon, 13 May 2024 08:16:25 -0400 Subject: [PATCH 04/14] Add `active` prop deprecation to changelog --- packages/@headlessui-react/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index 952035f4e6..120aea2b6e 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -70,6 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Require React 18 ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887), [#3092](https://github.com/tailwindlabs/headlessui/pull/3092), [#3131](https://github.com/tailwindlabs/headlessui/pull/3131)) - Always render hidden form input fields for `Checkbox`, `Switch`, and `RadioGroup` components ([#3095](https://github.com/tailwindlabs/headlessui/pull/3095)) - Deprecate the `RadioGroup.Option` component in favor of new `Radio` component ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) +- Deprecated the `MenuItem` `active` prop in favor of new `focus` prop ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) - Dialog is now focused by default instead of the first focusable element ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) - Change default tags for `ListboxOptions`, `ListboxOption`, `ComboboxOptions`, `ComboboxOption`, and `TabGroup` components ([#3109](https://github.com/tailwindlabs/headlessui/pull/3109)) - Change default tag from `div` to `Fragment` on `Transition` components ([#3110](https://github.com/tailwindlabs/headlessui/pull/3110), [#3147](https://github.com/tailwindlabs/headlessui/pull/3147)) From 3407625c511e55771b219209bb9219a3f55a5e09 Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Mon, 13 May 2024 08:18:05 -0400 Subject: [PATCH 05/14] Use same tense --- packages/@headlessui-react/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index 120aea2b6e..43e1ac4ac0 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -70,7 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Require React 18 ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887), [#3092](https://github.com/tailwindlabs/headlessui/pull/3092), [#3131](https://github.com/tailwindlabs/headlessui/pull/3131)) - Always render hidden form input fields for `Checkbox`, `Switch`, and `RadioGroup` components ([#3095](https://github.com/tailwindlabs/headlessui/pull/3095)) - Deprecate the `RadioGroup.Option` component in favor of new `Radio` component ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) -- Deprecated the `MenuItem` `active` prop in favor of new `focus` prop ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) +- Deprecate the `MenuItem` `active` prop in favor of new `focus` prop ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) - Dialog is now focused by default instead of the first focusable element ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) - Change default tags for `ListboxOptions`, `ListboxOption`, `ComboboxOptions`, `ComboboxOption`, and `TabGroup` components ([#3109](https://github.com/tailwindlabs/headlessui/pull/3109)) - Change default tag from `div` to `Fragment` on `Transition` components ([#3110](https://github.com/tailwindlabs/headlessui/pull/3110), [#3147](https://github.com/tailwindlabs/headlessui/pull/3147)) From 300e9eb95777210fd43570d31aae7da5b87d381f Mon Sep 17 00:00:00 2001 From: Jonathan Reinink Date: Mon, 13 May 2024 08:22:33 -0400 Subject: [PATCH 06/14] Update changelog --- packages/@headlessui-react/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index 43e1ac4ac0..79e3c7b041 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -70,7 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Require React 18 ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887), [#3092](https://github.com/tailwindlabs/headlessui/pull/3092), [#3131](https://github.com/tailwindlabs/headlessui/pull/3131)) - Always render hidden form input fields for `Checkbox`, `Switch`, and `RadioGroup` components ([#3095](https://github.com/tailwindlabs/headlessui/pull/3095)) - Deprecate the `RadioGroup.Option` component in favor of new `Radio` component ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) -- Deprecate the `MenuItem` `active` prop in favor of new `focus` prop ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) +- Deprecate the `active` prop in favor of new `focus` prop ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) - Dialog is now focused by default instead of the first focusable element ([#2887](https://github.com/tailwindlabs/headlessui/pull/2887)) - Change default tags for `ListboxOptions`, `ListboxOption`, `ComboboxOptions`, `ComboboxOption`, and `TabGroup` components ([#3109](https://github.com/tailwindlabs/headlessui/pull/3109)) - Change default tag from `div` to `Fragment` on `Transition` components ([#3110](https://github.com/tailwindlabs/headlessui/pull/3110), [#3147](https://github.com/tailwindlabs/headlessui/pull/3147)) From 045f2bc761be3d30ef203ccb3da2c0292c8a5397 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Tue, 21 May 2024 13:07:04 +0200 Subject: [PATCH 07/14] Ensure page doesn't scroll down when pressing `Escape` to close the `Dialog` component (#3218) * ensure we blur the `document.activeElement` when pressing `Escape` * update changelog --- packages/@headlessui-react/CHANGELOG.md | 1 + .../src/components/dialog/dialog.tsx | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index 79e3c7b041..eea24174dc 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - [internal] Don’t set a focus fallback for Dialog’s in demo mode ([#3194](https://github.com/tailwindlabs/headlessui/pull/3194)) +- Ensure page doesn't scroll down when pressing `Escape` to close the `Dialog` component ([#3218](https://github.com/tailwindlabs/headlessui/pull/3218)) ## [2.0.3] - 2024-05-07 diff --git a/packages/@headlessui-react/src/components/dialog/dialog.tsx b/packages/@headlessui-react/src/components/dialog/dialog.tsx index 958fab3748..3032001ded 100644 --- a/packages/@headlessui-react/src/components/dialog/dialog.tsx +++ b/packages/@headlessui-react/src/components/dialog/dialog.tsx @@ -310,6 +310,21 @@ function DialogFn( if (event.key !== Keys.Escape) return event.preventDefault() event.stopPropagation() + + // Ensure that we blur the current activeElement to prevent maintaining + // focus and potentially scrolling the page to the end (because the Dialog + // is rendered in a Portal at the end of the document.body and the browser + // tries to keep the focused element in view) + // + // Typically only happens in Safari. + if ( + document.activeElement && + 'blur' in document.activeElement && + typeof document.activeElement.blur === 'function' + ) { + document.activeElement.blur() + } + close() }) From 7fcb410be487017cde3b02c19adc7815a35b8ed9 Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Wed, 22 May 2024 14:57:57 +0200 Subject: [PATCH 08/14] do not apply `aria-modal` in demo mode (#3227) When you have a `role="dialog"` and an `aria-modal="true"` at the same time, then Safari will focus the first focusable element inside the dialog. This is not ideal, because in demo mode this means that the focus is moved around to various DOM elements. This commit ensures that the `aria-modal` is not applied when demo mode is enabled to prevent that behavior in Safari. --- packages/@headlessui-react/src/components/dialog/dialog.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@headlessui-react/src/components/dialog/dialog.tsx b/packages/@headlessui-react/src/components/dialog/dialog.tsx index 3032001ded..f940253c1b 100644 --- a/packages/@headlessui-react/src/components/dialog/dialog.tsx +++ b/packages/@headlessui-react/src/components/dialog/dialog.tsx @@ -357,7 +357,7 @@ function DialogFn( id, role, tabIndex: -1, - 'aria-modal': dialogState === DialogStates.Open ? true : undefined, + 'aria-modal': __demoMode ? undefined : dialogState === DialogStates.Open ? true : undefined, 'aria-labelledby': state.titleId, 'aria-describedby': describedby, } From b478189fad48a64aa14959fc33142a130eec2ccf Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Thu, 23 May 2024 16:24:26 +0200 Subject: [PATCH 09/14] Mark `SwitchGroup` as deprecated, prefer `Field` instead (#3232) * mark `SwitchGroup` as deprecated Also updated the `Switch.Group` message to also prefer the `` component. * update changelog --- packages/@headlessui-react/CHANGELOG.md | 4 ++++ packages/@headlessui-react/src/components/switch/switch.tsx | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/@headlessui-react/CHANGELOG.md b/packages/@headlessui-react/CHANGELOG.md index eea24174dc..81d5825c63 100644 --- a/packages/@headlessui-react/CHANGELOG.md +++ b/packages/@headlessui-react/CHANGELOG.md @@ -12,6 +12,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [internal] Don’t set a focus fallback for Dialog’s in demo mode ([#3194](https://github.com/tailwindlabs/headlessui/pull/3194)) - Ensure page doesn't scroll down when pressing `Escape` to close the `Dialog` component ([#3218](https://github.com/tailwindlabs/headlessui/pull/3218)) +### Deprecated + +- Mark `SwitchGroup` as deprecated, prefer `Field` instead ([#3232](https://github.com/tailwindlabs/headlessui/pull/3232)) + ## [2.0.3] - 2024-05-07 ### Fixed diff --git a/packages/@headlessui-react/src/components/switch/switch.tsx b/packages/@headlessui-react/src/components/switch/switch.tsx index a5715dc7b8..e1080faded 100644 --- a/packages/@headlessui-react/src/components/switch/switch.tsx +++ b/packages/@headlessui-react/src/components/switch/switch.tsx @@ -269,6 +269,7 @@ export interface _internal_ComponentSwitchLabel extends _internal_ComponentLabel export interface _internal_ComponentSwitchDescription extends _internal_ComponentDescription {} let SwitchRoot = forwardRefWithAs(SwitchFn) as _internal_ComponentSwitch +/** @deprecated use `` instead of `` */ export let SwitchGroup = GroupFn as _internal_ComponentSwitchGroup /** @deprecated use `