Skip to content

Commit ea5f21a

Browse files
Improve Combobox input cursor position (#1574)
* fix(combobox): fix focus on option select * update changelog Co-authored-by: Dan Roujinsky <[email protected]>
1 parent aa0056f commit ea5f21a

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

packages/@headlessui-react/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Fix incorrect transitionend/transitioncancel events for the Transition component ([#1537](https://github.com/tailwindlabs/headlessui/pull/1537))
1818
- Improve outside click of `Dialog` component ([#1546](https://github.com/tailwindlabs/headlessui/pull/1546))
1919
- Detect outside clicks from within `<iframe>` elements ([#1552](https://github.com/tailwindlabs/headlessui/pull/1552))
20+
- Improve Combobox input cursor position ([#1574](https://github.com/tailwindlabs/headlessui/pull/1574))
2021

2122
## [1.6.4] - 2022-05-29
2223

packages/@headlessui-react/src/components/combobox/combobox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ let Option = forwardRefWithAs(function Option<
10641064
select()
10651065
if (data.mode === ValueMode.Single) {
10661066
actions.closeCombobox()
1067-
disposables().nextFrame(() => data.inputRef.current?.focus({ preventScroll: true }))
1067+
data.inputRef.current?.focus({ preventScroll: true })
10681068
}
10691069
})
10701070

packages/@headlessui-vue/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818
- Improve outside click of `Dialog` component ([#1546](https://github.com/tailwindlabs/headlessui/pull/1546))
1919
- Detect outside clicks from within `<iframe>` elements ([#1552](https://github.com/tailwindlabs/headlessui/pull/1552))
2020
- Only render the `Dialog` on the client ([#1566](https://github.com/tailwindlabs/headlessui/pull/1566))
21+
- Improve Combobox input cursor position ([#1574](https://github.com/tailwindlabs/headlessui/pull/1574))
2122

2223
## [1.6.4] - 2022-05-29
2324

packages/@headlessui-vue/src/components/combobox/combobox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -892,7 +892,7 @@ export let ComboboxOption = defineComponent({
892892
api.selectOption(id)
893893
if (api.mode.value === ValueMode.Single) {
894894
api.closeCombobox()
895-
nextTick(() => dom(api.inputRef)?.focus({ preventScroll: true }))
895+
dom(api.inputRef)?.focus({ preventScroll: true })
896896
}
897897
}
898898

0 commit comments

Comments
 (0)