Skip to content

Conversation

@far-fetched
Copy link
Contributor

@far-fetched far-fetched commented Dec 15, 2022

Failing test reference: click

fixes: #137

Issue:

In this repo, we vastly used the pattern "register children elements" in modifier. Then when in modifier callback, we use this.args.* it will be reevaluated when that args changes <-- this is desired behavior.
But because of this mechanism, we have to be very careful what functions are called inside modifier. This bug is caused by calling this.scrollIntoView more than once. It affects the situation when user selects a new value (test) or new options are lazy loaded.

Solution:

It turns out that we can scroll listbox option into viewport not from root component, but delegate it to children (option). There is an only one moment when option should be scrolled (when is selected – what is being checked in constructor of option).

Before:

Lazy loaded options with "jumpy" effect when promise resolved:

simplescreenrecorder-2022-12-16_08.03.25.mp4

After:

simplescreenrecorder-2022-12-16_08.07.05.mp4

@far-fetched far-fetched force-pushed the fix/listbox-scroll-option-into-view branch 2 times, most recently from 5546bfb to 19732aa Compare December 16, 2022 07:21
@far-fetched far-fetched force-pushed the fix/listbox-scroll-option-into-view branch from 19732aa to 1bedfff Compare December 16, 2022 07:23
@dmcnamara-eng dmcnamara-eng self-requested a review December 19, 2022 13:59
@dmcnamara-eng
Copy link
Collaborator

Looks solid 👊 Tested manually locally by mutating list of options and working well ✅

@dmcnamara-eng dmcnamara-eng merged commit 4113274 into GavinJoyce:master Dec 19, 2022
@NullVoxPopuli NullVoxPopuli added the enhancement New feature or request label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants