(index)
| 654 | } |
| 655 | |
| 656 | function setSelectedRow(index) { |
| 657 | // Remove previous selection |
| 658 | if ( |
| 659 | currentSelectedIndex >= 0 && |
| 660 | currentSelectedIndex < allNavigableRows.length |
| 661 | ) { |
| 662 | allNavigableRows[currentSelectedIndex].classList.remove( |
| 663 | "keyboard-selected", |
| 664 | ); |
| 665 | } |
| 666 | |
| 667 | // Set new selection |
| 668 | currentSelectedIndex = index; |
| 669 | if ( |
| 670 | currentSelectedIndex >= 0 && |
| 671 | currentSelectedIndex < allNavigableRows.length |
| 672 | ) { |
| 673 | const selectedRow = allNavigableRows[currentSelectedIndex]; |
| 674 | selectedRow.classList.add("keyboard-selected"); |
| 675 | |
| 676 | // Scroll into view if needed |
| 677 | selectedRow.scrollIntoView({ |
| 678 | behavior: "smooth", |
| 679 | block: "nearest", |
| 680 | }); |
| 681 | } |
| 682 | } |
| 683 | |
| 684 | function handleKeyboardNavigation(event) { |
| 685 | // Don't handle keyboard navigation if a dialog is open or input is focused |
no outgoing calls
no test coverage detected