You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Elastic.Documentation.Site/Assets/web-components/SearchOrAskAi/Search/SearchResults/SearchResultsListItem.tsx
+20-13Lines changed: 20 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -107,6 +107,21 @@ export function SearchResultListItem({
107
107
role="option"
108
108
aria-selected={isSelected}
109
109
onClick={handleClick}
110
+
onMouseEnter={(e)=>{
111
+
// If another result item has focus, move focus to this item
112
+
if(document.activeElementinstanceofHTMLElement){
113
+
constisResultItem=document.activeElement.closest(
114
+
'[data-search-results]'
115
+
)
116
+
if(
117
+
isResultItem&&
118
+
document.activeElement!==e.currentTarget
119
+
){
120
+
e.currentTarget.focus()
121
+
}
122
+
}
123
+
onSelect?.(index)
124
+
}}
110
125
onFocus={()=>onSelect?.(index)}
111
126
onKeyDown={(e)=>onKeyDown?.(e,index)}
112
127
css={css`
@@ -126,23 +141,15 @@ export function SearchResultListItem({
126
141
outline: none;
127
142
outline-color: transparent;
128
143
129
-
/* Highlight styles for selected and hovered items */
0 commit comments