Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace li.scrollIntoViewIfNeeded() with li.scrollIntoView() #88

Merged
merged 12 commits into from
Jun 27, 2022

Conversation

janosh
Copy link
Owner

@janosh janosh commented Jun 26, 2022

Closes #87.

scrollIntoViewIfNeeded was never standardized. While it has pretty good browser support (currently at 92%), it doesn't exist in Firefox leading to the error in #87.

Also fixes a scrolling into view sometimes not working when wrapping around start/end of dropdown list using a setTimeout hack.

janosh added 12 commits June 26, 2022 18:42
…ew() (#87)

and fix scrolling into view being flaky when wrapping around start/end of dropdown list with ugly setTimeout hack
custom option was always created as object
…nsert and append mode

prev: both food, now: food and languages
waiting for selector "div.multiselect > ul.options" to be visible
  selector resolved to hidden <ul class="options baz s-A85w8bJ9QKLL hidden">…</ul>
============================================================
❯tests/multiselect.test.ts:125:13
123|
124|   await page.click(`input[id='foods']`)
125|   await page.waitForSelector(`div.multiselect > ul.options`, {
   | ^
126|     state: `visible`,
127|   })
waiting for selector "div.multiselect > ul.options > li"
  selector resolved to 33 elements. Proceeding with the first one.
  selector resolved to hidden <li aria-selected="false" class="s-A85w8bJ9QKLL">🍇 Grapes </li>
attempting click action
  waiting for element to be visible, enabled and stable
    element is not visible - waiting...
============================================================
❯tests/multiselect.test.ts:93:13
 91|
 92|   await page.click(`div.multiselect`) // open the dropdown
 93|   await page.click(`div.multiselect > ul.options > li`) // select 1st …
   | ^
…0ms exceeded.

waiting for element to be visible
    element is not visible - waiting...
============================================================
❯tests/multiselect.test.ts:128:20
126|   await page.click(`input#foods`)
127|   const ul_options = await page.$(`div.multiselect > ul.options`)
128|   await ul_options?.waitForElementState(`visible`)
   | ^
129|
130|   await page.hover(`text=🍌 Banana`) // hover any option to give it act…
@janosh janosh merged commit c8f8766 into main Jun 27, 2022
@janosh janosh deleted the replace-non-standard-scrollintoviewifneeded branch June 27, 2022 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

li.scrollIntoViewIfNeeded is not a function error in console during keyboard navigation
1 participant