MCPcopy Index your code
hub / github.com/UI5/webcomponents / _handleArrowNavigation

Method _handleArrowNavigation

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

Source from the content-addressed store, hash-verified

860 }
861
862 _handleArrowNavigation(e: KeyboardEvent) {
863 e.preventDefault();
864
865 if (this.readonly) {
866 return;
867 }
868
869 let nextIndex = -1;
870 const currentIndex = this._selectedIndex;
871 const isDownKey = isDown(e);
872
873 if (isDownKey) {
874 nextIndex = this._getNextOptionIndex();
875 } else {
876 nextIndex = this._getPreviousOptionIndex();
877 }
878
879 this._changeSelectedItem(this._selectedIndex, nextIndex);
880
881 if (currentIndex !== this._selectedIndex) {
882 // Announce new item even if picker is opened.
883 // The aria-activedescendents attribute can't be used,
884 // because listitem elements are in different shadow dom
885 this.itemSelectionAnnounce();
886 this._scrollSelectedItem();
887 }
888 }
889
890 _changeSelectedItem(oldIndex: number, newIndex: number) {
891 const options: Array<IOption> = this.options;

Callers 1

_onkeydownMethod · 0.95

Calls 6

_getNextOptionIndexMethod · 0.95
_changeSelectedItemMethod · 0.95
itemSelectionAnnounceMethod · 0.95
_scrollSelectedItemMethod · 0.95
isDownFunction · 0.85

Tested by

no test coverage detected