File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change 5
5
useContext ,
6
6
useId ,
7
7
useLayoutEffect ,
8
- useMemo ,
9
8
useRef ,
10
9
useState ,
11
10
} from 'preact/hooks' ;
@@ -286,10 +285,6 @@ function SelectMain<T>({
286
285
const listboxId = useId ( ) ;
287
286
const buttonRef = useSyncedRef ( elementRef ) ;
288
287
const defaultButtonId = useId ( ) ;
289
- const extraProps = useMemo (
290
- ( ) => ( listboxAsPopover ? { popover : '' } : { } ) ,
291
- [ listboxAsPopover ] ,
292
- ) ;
293
288
294
289
useListboxPositioning (
295
290
buttonRef ,
@@ -376,7 +371,6 @@ function SelectMain<T>({
376
371
</ button >
377
372
< SelectContext . Provider value = { { selectValue, value } } >
378
373
< ul
379
- { ...extraProps }
380
374
className = { classnames (
381
375
'absolute z-5 max-h-80 overflow-y-auto' ,
382
376
'rounded border bg-white shadow hover:shadow-md focus-within:shadow-md' ,
@@ -397,6 +391,10 @@ function SelectMain<T>({
397
391
aria-orientation = "vertical"
398
392
data-testid = "select-listbox"
399
393
data-listbox-open = { listboxOpen }
394
+ // nb. Use `undefined` rather than `false` because Preact doesn't
395
+ // handle boolean values correctly for this attribute (it will set
396
+ // `popover="false"` instead of removing the attribute).
397
+ popover = { listboxAsPopover ? 'auto' : undefined }
400
398
>
401
399
{ children }
402
400
</ ul >
You can’t perform that action at this time.
0 commit comments