File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
packages/kit-headless/src/components/select Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -62,9 +62,14 @@ export const HSelectItem = component$<SelectItemProps>((props) => {
62
62
localIndexSig . value = _index ;
63
63
} ) ;
64
64
65
- useTask$ ( async function scrollableTask ( { track, cleanup } ) {
65
+ useTask$ ( async function navigationTask ( { track, cleanup } ) {
66
66
track ( ( ) => context . highlightedIndexSig . value ) ;
67
67
68
+ // update the context with the highlighted item ref
69
+ if ( localIndexSig . value === context . highlightedIndexSig . value ) {
70
+ context . highlightedItemRef = itemRef ;
71
+ }
72
+
68
73
if ( isServer ) return ;
69
74
70
75
let observer : IntersectionObserver ;
@@ -90,11 +95,6 @@ export const HSelectItem = component$<SelectItemProps>((props) => {
90
95
observer . observe ( itemRef . value ) ;
91
96
}
92
97
}
93
-
94
- // update the context with the highlighted item ref
95
- if ( localIndexSig . value === context . highlightedIndexSig . value ) {
96
- context . highlightedItemRef = itemRef ;
97
- }
98
98
} ) ;
99
99
100
100
const handleClick$ = $ ( async ( ) => {
@@ -222,7 +222,7 @@ export const HSelectItem = component$<SelectItemProps>((props) => {
222
222
data-selected = { isSelectedSig . value ? '' : undefined }
223
223
data-highlighted = { isHighlightedSig . value ? '' : undefined }
224
224
data-disabled = { disabled ? '' : undefined }
225
- data-item = { _index }
225
+ data-item
226
226
role = "option"
227
227
>
228
228
< Slot />
You can’t perform that action at this time.
0 commit comments