Skip to content

Commit

Permalink
Improve Combobox re-opening keyboard issue on mobile (#1732)
Browse files Browse the repository at this point in the history
* prevent re-focusing Combobox Input after choosing selection

On mobile this gives a bit of annoying results where after choosing an
option, the keyboard is shown again because the input is focused again.

* update changelog
  • Loading branch information
RobinMalfait committed Aug 1, 2022
1 parent cbb4f19 commit 4d88dd9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve event handler merging ([#1715](https://github.com/tailwindlabs/headlessui/pull/1715))
- Fix incorrect scrolling to the bottom when opening a `Dialog` ([#1716](https://github.com/tailwindlabs/headlessui/pull/1716))
- Make form components uncontrollable ([#1683](https://github.com/tailwindlabs/headlessui/pull/1683))
- Improve `Combobox` re-opening keyboard issue on mobile ([#1732](https://github.com/tailwindlabs/headlessui/pull/1732))

## [1.6.6] - 2022-07-07

Expand Down
Expand Up @@ -1069,7 +1069,6 @@ let Option = forwardRefWithAs(function Option<
select()
if (data.mode === ValueMode.Single) {
actions.closeCombobox()
data.inputRef.current?.focus({ preventScroll: true })
}
})

Expand Down
1 change: 1 addition & 0 deletions packages/@headlessui-vue/CHANGELOG.md
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix incorrect scrolling to the bottom when opening a `Dialog` ([#1716](https://github.com/tailwindlabs/headlessui/pull/1716))
- Don't overwrite `element.focus()` on `<PopoverPanel>` ([#1719](https://github.com/tailwindlabs/headlessui/pull/1719))
- Make form components uncontrollable ([#1683](https://github.com/tailwindlabs/headlessui/pull/1683))
- Improve `Combobox` re-opening keyboard issue on mobile ([#1732](https://github.com/tailwindlabs/headlessui/pull/1732))

## [1.6.7] - 2022-07-12

Expand Down
Expand Up @@ -915,7 +915,6 @@ export let ComboboxOption = defineComponent({
api.selectOption(id)
if (api.mode.value === ValueMode.Single) {
api.closeCombobox()
dom(api.inputRef)?.focus({ preventScroll: true })
}
}

Expand Down

0 comments on commit 4d88dd9

Please sign in to comment.