MCPcopy Create free account
hub / github.com/UI5/webcomponents / _handleKeyboardNavigation

Method _handleKeyboardNavigation

packages/main/src/Select.ts:710–733  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

708 }
709
710 _handleKeyboardNavigation(e: KeyboardEvent) {
711 if (this.readonly) {
712 return;
713 }
714
715 const typedCharacter = e.key.toLowerCase();
716
717 this._typedChars += typedCharacter;
718
719 // We check if we have more than one characters and they are all duplicate, we set the
720 // text to be the last input character (typedCharacter). If not, we set the text to be
721 // the whole input string.
722
723 const text = (/^(.)\1+$/i).test(this._typedChars) ? typedCharacter : this._typedChars;
724
725 clearTimeout(this._typingTimeoutID);
726
727 this._typingTimeoutID = setTimeout(() => {
728 this._typedChars = "";
729 this._typingTimeoutID = -1;
730 }, 1000);
731
732 this._selectTypedItem(text);
733 }
734
735 _selectTypedItem(text: string) {
736 const currentIndex = this._selectedIndex;

Callers 1

_onkeydownMethod · 0.95

Calls 1

_selectTypedItemMethod · 0.95

Tested by

no test coverage detected