Skip to content

fix: prevent dashboard from losing focus in Firefox#11659

Merged
web-padawan merged 2 commits intomainfrom
fix/dashboard-focus-loss-firefox
May 6, 2026
Merged

fix: prevent dashboard from losing focus in Firefox#11659
web-padawan merged 2 commits intomainfrom
fix/dashboard-focus-loss-firefox

Conversation

@web-padawan
Copy link
Copy Markdown
Member

@web-padawan web-padawan commented May 6, 2026

Fixes #11644

Firefox 148+ silently drops focus from a slotted element when the <slot> it was projected through is reassigned during the shadow-DOM re-render in __renderItemWrappers. No blur or focusout events fire — document.activeElement simply becomes <body> after the next frame.

const dashboard = document.querySelector('vaadin-dashboard');
dashboard.querySelector('vaadin-dashboard-widget input').focus();
dashboard.items = [...dashboard.items];
// In Firefox 148+: document.activeElement === document.body

Cache the focused element before the re-render and re-focus it inside the existing requestAnimationFrame block when it lost focus and its wrapper was not removed.

The existing focus tests in `packages/dashboard/test/dashboard.test.ts` cover the regression scenarios. They pass on Firefox 144 (current CI) regardless of the fix and will start exercising it once CI moves to Firefox 148+ via the upcoming Playwright bump.

Reported upstream: https://bugzilla.mozilla.org/show_bug.cgi?id=2037008


🤖 Generated with Claude Code

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

@web-padawan web-padawan merged commit 4305755 into main May 6, 2026
10 checks passed
@web-padawan web-padawan deleted the fix/dashboard-focus-loss-firefox branch May 6, 2026 13:42
web-padawan added a commit that referenced this pull request May 6, 2026
) (#11665)

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
web-padawan added a commit that referenced this pull request May 6, 2026
) (#11666)

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

[dashboard] Focus silently dropped to <body> on item update in Firefox 148+

3 participants