Skip to content

fix: prevent dashboard from losing focus in Firefox (#11659) (CP: 25.1)#11665

Merged
web-padawan merged 2 commits into25.1from
cherry-pick-11659-to-25.1-1778075271506
May 6, 2026
Merged

fix: prevent dashboard from losing focus in Firefox (#11659) (CP: 25.1)#11665
web-padawan merged 2 commits into25.1from
cherry-pick-11659-to-25.1-1778075271506

Conversation

@vaadin-bot
Copy link
Copy Markdown
Collaborator

This PR cherry-picks changes from the original PR #11659 to branch 25.1.


Original PR description

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

)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment thread packages/dashboard/src/vaadin-dashboard.js Outdated
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@web-padawan web-padawan merged commit c3d3afc into 25.1 May 6, 2026
9 of 10 checks passed
@web-padawan web-padawan deleted the cherry-pick-11659-to-25.1-1778075271506 branch May 6, 2026 14:03
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.

2 participants