File tree Expand file tree Collapse file tree 4 files changed +75
-5
lines changed Expand file tree Collapse file tree 4 files changed +75
-5
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,76 @@ describe("Properties", () => {
88
88
. should ( "be.focused" ) ;
89
89
} ) ;
90
90
91
+ it ( "items slot arrow down navigation with groups and headerText" , ( ) => {
92
+ cy . mount (
93
+ < Search >
94
+ < SearchItemGroup headerText = "Group Header 1" >
95
+ < SearchItem text = "List Item" icon = { history } > </ SearchItem >
96
+ < SearchItem text = "List Item" icon = { searchIcon } > </ SearchItem >
97
+ </ SearchItemGroup >
98
+ </ Search >
99
+ ) ;
100
+
101
+ cy . get ( "[ui5-search]" )
102
+ . shadow ( )
103
+ . find ( "input" )
104
+ . realClick ( ) ;
105
+
106
+ cy . get ( "[ui5-search]" )
107
+ . realPress ( "L" ) ;
108
+
109
+ cy . get ( "[ui5-search]" )
110
+ . should ( "be.focused" ) ;
111
+
112
+ cy . get ( "[ui5-search]" )
113
+ . realPress ( "ArrowDown" ) ;
114
+
115
+ cy . get ( "ui5-search-item-group" )
116
+ . shadow ( )
117
+ . find ( "ui5-li-group-header" )
118
+ . should ( "be.focused" ) ;
119
+
120
+ cy . get ( "[ui5-search]" )
121
+ . realPress ( "ArrowUp" ) ;
122
+
123
+ cy . get ( "[ui5-search]" )
124
+ . should ( "be.focused" ) ;
125
+ } ) ;
126
+
127
+ it . only ( "items slot arrow down navigation with groups and no headerText" , ( ) => {
128
+ cy . mount (
129
+ < Search >
130
+ < SearchItemGroup >
131
+ < SearchItem text = "List Item" icon = { history } > </ SearchItem >
132
+ < SearchItem text = "List Item" icon = { searchIcon } > </ SearchItem >
133
+ </ SearchItemGroup >
134
+ </ Search >
135
+ ) ;
136
+
137
+ cy . get ( "[ui5-search]" )
138
+ . shadow ( )
139
+ . find ( "input" )
140
+ . realClick ( ) ;
141
+
142
+ cy . get ( "[ui5-search]" )
143
+ . realPress ( "L" ) ;
144
+
145
+ cy . get ( "[ui5-search]" )
146
+ . should ( "be.focused" ) ;
147
+
148
+ cy . get ( "[ui5-search]" )
149
+ . realPress ( "ArrowDown" ) ;
150
+
151
+ cy . get ( "ui5-search-item" ) . eq ( 0 )
152
+ . should ( "be.focused" ) ;
153
+
154
+ cy . get ( "[ui5-search]" )
155
+ . realPress ( "ArrowUp" ) ;
156
+
157
+ cy . get ( "[ui5-search]" )
158
+ . should ( "be.focused" ) ;
159
+ } )
160
+
91
161
it ( "items should be shown instead of illustration of both present " , ( ) => {
92
162
cy . mount (
93
163
< Search >
Original file line number Diff line number Diff line change @@ -354,7 +354,7 @@ class Search extends SearchField {
354
354
}
355
355
356
356
_handleArrowDown ( ) {
357
- const firstListItem = this . _getItemsList ( ) ?. getSlottedNodes < ISearchSuggestionItem > ( "items" ) [ 0 ] ;
357
+ const firstListItem = this . _getItemsList ( ) ?. listItems ?. [ 0 ] ;
358
358
359
359
if ( this . open ) {
360
360
this . _deselectItems ( ) ;
Original file line number Diff line number Diff line change @@ -26,10 +26,6 @@ class SearchItemGroup extends ListItemGroup {
26
26
get isGroupItem ( ) : boolean {
27
27
return true ;
28
28
}
29
-
30
- getFocusDomRef ( ) {
31
- return this . shadowRoot ! . querySelector ( "[ui5-li-group-header]" ) as ListItemGroupHeader ;
32
- }
33
29
}
34
30
35
31
SearchItemGroup . define ( ) ;
Original file line number Diff line number Diff line change @@ -232,6 +232,10 @@ class ListItemGroup extends UI5Element {
232
232
233
233
this . dropIndicatorDOM ! . targetReference = null ;
234
234
}
235
+
236
+ getFocusDomRef ( ) {
237
+ return this . groupHeaderItem || this . items [ 0 ] ;
238
+ }
235
239
}
236
240
237
241
ListItemGroup . define ( ) ;
You can’t perform that action at this time.
0 commit comments