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

Method _scrollToItem

packages/main/src/ComboBox.ts:1492–1510  ·  view source on GitHub ↗
(indexOfItem: number)

Source from the content-addressed store, hash-verified

1490 }
1491
1492 _scrollToItem(indexOfItem: number) {
1493 const picker = this._getPicker();
1494 const list = this._getItemsList();
1495 const listItem = list?.listItems[indexOfItem];
1496
1497 if (listItem) {
1498 const pickerRect = picker.getBoundingClientRect();
1499 const listItemRect = listItem.getBoundingClientRect();
1500 const isListItemInVisibleArea = listItemRect.top >= pickerRect.top && listItemRect.bottom <= pickerRect.bottom;
1501
1502 if (!isListItemInVisibleArea) {
1503 listItem.scrollIntoView({
1504 behavior: "auto",
1505 block: "nearest",
1506 inline: "nearest",
1507 });
1508 }
1509 }
1510 }
1511
1512 _announceValueStateText() {
1513 const valueStateText = this.shouldDisplayDefaultValueStateMessage ? this.valueStateDefaultText : this.valueStateMessage.map(el => el.textContent).join(" ");

Callers 2

_afterOpenPopoverMethod · 0.95
_handleItemNavigationMethod · 0.95

Calls 2

_getPickerMethod · 0.95
_getItemsListMethod · 0.95

Tested by

no test coverage detected