nice-select2 icon indicating copy to clipboard operation
nice-select2 copied to clipboard

Use arrow keys to navigate up and down when overflow-y is scrollable

Open ivanakruljac opened this issue 2 years ago • 2 comments

So, the _onKeyPressed function selects the next element, but if there is overflow-y scroll applied to the ul list, it doesn't move the position with keycode = 38 and keycode = 40. User needs to use mouse to acually scroll thru list.

This is something that would be very nice to have :)

Many thanks!

Ivana

nice-select2

ivanakruljac avatar Dec 22 '23 14:12 ivanakruljac

      const niceSelect = new NiceSelect2(select, {});
      // When niceSelect.dropdown gets the class open. find the li with the class .focus and scrollIntoView
      niceSelect.dropdown.addEventListener('transitionend', () => {
        if (niceSelect.dropdown.classList.contains('open')) {
          const focus = niceSelect.dropdown.querySelector('.focus');
          if (focus) {
            focus.scrollIntoView({ block: 'nearest' });
          }
        }
      });

Brayn7 avatar Dec 17 '24 17:12 Brayn7

Thank you! Works!

ivanakruljac avatar Mar 11 '25 08:03 ivanakruljac

fixed

Tsjippy avatar Jul 22 '25 12:07 Tsjippy