microsoft / fast

The adaptive interface system for modern web experiences.
https://www.fast.design
Other
9.28k stars 595 forks source link

fix: Combobox does not scroll option into view at times in `fast-foundation` #6776

Closed atmgrifter00 closed 5 months ago

atmgrifter00 commented 1 year ago

🐛 Bug Report

There are situations where while typing into the Combobox the selected item does not scroll into view, when there doesn't seem to be a functional reason why that would be.

Specifically, this seems to be an issue with either the inline or none autocomplete setting.

💻 Repro or Code Sample

Stackblitz example

If you type 'a', you will see the first option become selected. If you continue typing by adding 'b' ('ab' is now in the input), you will see that 'ab' is not scrolled into view, though it is indeed selected which you can see if you scroll down manually. If you instead, from an empty input, typed in 'z', you will see 'zoo' be immediately scrolled into view.

🤔 Expected Behavior

Any newly selected item as you type should be scrolled into view.

😯 Current Behavior

Newly selected items as you type with either the inline or none autocomplete setting at times are not scrolled into view (see reproducing example above)).

💁 Possible Solution

It seems like the Combobox should just call its focusAndScrollOptionIntoView method more aggressively. I imagine in the inputHandler implementation you could just always call it, or at worst, scope it to if the current input value (this.control.value) is not the same as this.value.

🔦 Context

https://github.com/ni/nimble/issues/1325

🌍 Your Environment

janechu commented 5 months ago

Unfortunately @microsoft/fast-foundation is being deprecated, refer to #6955.