File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010- Nothing yet!
1111
12+ ### Fixed
13+
14+ - Prevent closing the ` Combobox ` component when clicking inside the scrollbar area ([ #3104 ] ( https://github.com/tailwindlabs/headlessui/pull/3104 ) )
15+
1216## [ 1.7.20] - 2024-04-15
1317
1418### Fixed
Original file line number Diff line number Diff line change @@ -1382,6 +1382,15 @@ export let ComboboxOptions = defineComponent({
13821382 } ,
13831383 } )
13841384
1385+ /**
1386+ * Prevent focus from being lost if the user clicks on the scrollbar.
1387+ * Otherwise the `ComboboxInput` will lose focus and the combobox will
1388+ * close.
1389+ */
1390+ function handleMouseDown ( event : MouseEvent ) {
1391+ event . preventDefault ( )
1392+ }
1393+
13851394 return ( ) => {
13861395 let slot = { open : api . comboboxState . value === ComboboxStates . Open }
13871396 let ourProps = {
@@ -1390,6 +1399,7 @@ export let ComboboxOptions = defineComponent({
13901399 ref : api . optionsRef ,
13911400 role : 'listbox' ,
13921401 'aria-multiselectable' : api . mode . value === ValueMode . Multi ? true : undefined ,
1402+ onMousedown : handleMouseDown ,
13931403 }
13941404 let theirProps = omit ( props , [ 'hold' ] )
13951405
You can’t perform that action at this time.
0 commit comments