File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -243,11 +243,21 @@ export class TreeKeyManager<T extends TreeKeyManagerItem> {
243
243
break ;
244
244
}
245
245
246
+ // Attempt to use the `event.key` which also maps it to the user's keyboard language,
247
+ // otherwise fall back to resolving alphanumeric characters via the keyCode.
248
+ if ( event . key && event . key . length === 1 ) {
249
+ this . _letterKeyStream . next ( event . key . toLocaleUpperCase ( ) ) ;
250
+ } else if ( ( keyCode >= A && keyCode <= Z ) || ( keyCode >= ZERO && keyCode <= NINE ) ) {
251
+ this . _letterKeyStream . next ( String . fromCharCode ( keyCode ) ) ;
252
+ }
253
+
246
254
// NB: return here, in order to avoid preventing the default action of non-navigational
247
255
// keys or resetting the buffer of pressed letters.
248
256
return ;
249
257
}
250
258
259
+ // Reset the typeahead since the user has used a navigational key.
260
+ this . _pressedLetters = [ ] ;
251
261
event . preventDefault ( ) ;
252
262
}
253
263
You can’t perform that action at this time.
0 commit comments