File tree 3 files changed +30
-1
lines changed
3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -395,7 +395,7 @@ class Select extends UI5Element {
395
395
}
396
396
}
397
397
398
- if ( isEscape ( event ) ) {
398
+ if ( isEscape ( event ) && this . _isPickerOpen ) {
399
399
this . _escapePressed = true ;
400
400
}
401
401
Original file line number Diff line number Diff line change @@ -60,6 +60,12 @@ <h2>Selection not cycling</h2>
60
60
< ui5-option > Opt3</ ui5-option >
61
61
</ ui5-select >
62
62
63
+ < ui5-select id ="mySelectEsc ">
64
+ < ui5-option > Cozy</ ui5-option >
65
+ < ui5-option selected > Compact</ ui5-option >
66
+ < ui5-option > Condensed</ ui5-option >
67
+ </ ui5-select >
68
+
63
69
< h2 > Change event counter holder</ h2 >
64
70
< ui5-input id ="inputResult "> </ ui5-input >
65
71
Original file line number Diff line number Diff line change @@ -228,4 +228,27 @@ describe("Select general interaction", () => {
228
228
229
229
assert . strictEqual ( inputResult . getProperty ( "value" ) , "7" , "Change event should be fired" ) ;
230
230
} ) ;
231
+
232
+ it ( "tests ESC on closed picker" , ( ) => {
233
+ const select = $ ( "#mySelectEsc" ) ;
234
+ const selectText = browser . $ ( "#mySelectEsc" ) . shadow$ ( "ui5-label" ) ;
235
+ const EXPECTED_SELECTION_TEXT = "Cozy" ;
236
+ const EXPECTED_SELECTION_TEXT2 = "Condensed" ;
237
+
238
+ select . click ( ) ;
239
+ const staticAreaItemClassName = browser . getStaticAreaItemClassName ( "#mySelectEsc" )
240
+ const firstItem = browser . $ ( `.${ staticAreaItemClassName } ` ) . shadow$$ ( "ui5-li" ) [ 0 ] ;
241
+ const thirdItem = browser . $ ( `.${ staticAreaItemClassName } ` ) . shadow$$ ( "ui5-li" ) [ 2 ] ;
242
+
243
+ firstItem . click ( ) ;
244
+
245
+ assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT ) !== - 1 , "Select label is correct." ) ;
246
+
247
+ // verify that ESC does not interfere when the picker is closed
248
+ select . keys ( "Escape" ) ;
249
+ select . click ( ) ;
250
+ thirdItem . click ( ) ;
251
+
252
+ assert . ok ( selectText . getHTML ( false ) . indexOf ( EXPECTED_SELECTION_TEXT2 ) !== - 1 , "Select label is correct." ) ;
253
+ } ) ;
231
254
} ) ;
You can’t perform that action at this time.
0 commit comments