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

fix: force scroller update after revealing a date #8217

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

vursen
Copy link
Contributor

@vursen vursen commented Nov 22, 2024

Description

It turns out essential to flush all scroller debouncers before trying to focus any date to ensure the DOM is updated and the date is truly focusable. Previously, date.focus() could be called before the scrolled applied tabindex=0 to the date element, and this led to test failures because not all browsers allow focusing elements with tabindex=-1.

Part of #8187

Type of change

  • Bugfix

@vursen vursen requested a review from web-padawan November 22, 2024 12:18
@vursen vursen marked this pull request as ready for review November 22, 2024 12:18
@vursen vursen force-pushed the force-update-after-scrolling-to-dates branch 2 times, most recently from 0595c78 to 03dda97 Compare November 22, 2024 12:20
@vursen vursen force-pushed the force-update-after-scrolling-to-dates branch from 03dda97 to f933665 Compare November 22, 2024 12:21
/**
* @param {HTMLElement} root vaadin-date-picker or vaadin-date-picker-overlay-content
*/
export function getFocusableCell(root) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Having the focused part doesn't always mean that the cell is actually focused. I decided to split this helper into getFocusableCell and getFocusedCell for clarity.

*/
export async function waitForScrollToFinish(overlayContent) {
export async function waitForScrollToFinish(root) {
Copy link
Contributor Author

@vursen vursen Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I also changed the signature of these methods to allow tests to pass datePicker instead of datePicker._overlayContent which slightly more convenient.

@vursen vursen merged commit 5163e29 into main Nov 22, 2024
9 checks passed
@vursen vursen deleted the force-update-after-scrolling-to-dates branch November 22, 2024 12:30
vursen added a commit that referenced this pull request Nov 22, 2024
vursen added a commit that referenced this pull request Nov 22, 2024
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.6.0.beta3 and is also targeting the upcoming stable 24.6.0 version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants