Skip to content

Commit

Permalink
Improve Combobox input cursor position (#1574)
Browse files Browse the repository at this point in the history
* fix(combobox): fix focus on option select

* update changelog

Co-authored-by: Dan Roujinsky <d.roujinsky@island.io>
  • Loading branch information
RobinMalfait and danr-za committed Jun 10, 2022
1 parent aa0056f commit ea5f21a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Expand Up @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix incorrect transitionend/transitioncancel events for the Transition component ([#1537](https://github.com/tailwindlabs/headlessui/pull/1537))
- Improve outside click of `Dialog` component ([#1546](https://github.com/tailwindlabs/headlessui/pull/1546))
- Detect outside clicks from within `<iframe>` elements ([#1552](https://github.com/tailwindlabs/headlessui/pull/1552))
- Improve Combobox input cursor position ([#1574](https://github.com/tailwindlabs/headlessui/pull/1574))

## [1.6.4] - 2022-05-29

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

Expand Down
1 change: 1 addition & 0 deletions packages/@headlessui-vue/CHANGELOG.md
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve outside click of `Dialog` component ([#1546](https://github.com/tailwindlabs/headlessui/pull/1546))
- Detect outside clicks from within `<iframe>` elements ([#1552](https://github.com/tailwindlabs/headlessui/pull/1552))
- Only render the `Dialog` on the client ([#1566](https://github.com/tailwindlabs/headlessui/pull/1566))
- Improve Combobox input cursor position ([#1574](https://github.com/tailwindlabs/headlessui/pull/1574))

## [1.6.4] - 2022-05-29

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

Expand Down

0 comments on commit ea5f21a

Please sign in to comment.