Skip to content

[all components] Restore visible focus after keyboard close - #5093

Merged
atomiks merged 4 commits into
mui:masterfrom
lyzno1:codex/webkit-visible-focus-dismissal
Jun 22, 2026
Merged

atomiks merged 4 commits into
mui:masterfrom
lyzno1:codex/webkit-visible-focus-dismissal

Conversation

@lyzno1

@lyzno1 lyzno1 commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5092

This is a tentative fix for a Safari/Firefox focus-visible issue observed across popup components that use the shared FloatingFocusManager return-focus path.

When a popup is opened with a pointer and dismissed with Escape, WebKit restores DOM focus to the trigger but does not mark it as :focus-visible. Since the focus manager already tracks keyboard dismissal, this change requests visible focus only for keyboard-driven return focus.

Before After
Before: focus is restored without visible focus indication After: focus is restored with visible focus indication

This PR is intentionally small and can be closed if this behavior should be handled differently.

Validation:

  • pnpm test:webkit MenuPopup --no-watch
  • manual Playwright WebKit check against the Menu e2e fixture: pointer open + Escape close returns focus with :focus-visible

@pkg-pr-new

pkg-pr-new Bot commented Jun 20, 2026 •

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5093
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5093
    

commit: b8d7a97

@code-infra-dashboard

code-infra-dashboard Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+55B(+0.01%) 🔺+25B(+0.02%)

Details of bundle changes

Performance

Total duration: 1,117.86 ms +30.36 ms(+2.8%) | Renders: 78 (+0)

Test Duration Renders
Checkbox mount (500 instances) 75.22 ms 🔺+19.17 ms(+34.2%) 1 (+0)

13 tests within noise — details

Metric alarms

Test Metric Change
Checkbox mount (500 instances) bench:paint 🔺 +21.00 ms

Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Jun 20, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit b8d7a97
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a38b30d18f8ce0008774a1a
😎 Deploy Preview https://deploy-preview-5093--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@lyzno1
lyzno1 marked this pull request as ready for review June 20, 2026 18:20
@atomiks atomiks added type: bug It doesn't behave as expected. scope: all components Widespread work has an impact on almost all components. labels Jun 22, 2026

@atomiks atomiks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the fix @lyzno1

@atomiks
atomiks merged commit e6dc73d into mui:master Jun 22, 2026
6 checks passed
@lyzno1
lyzno1 deleted the codex/webkit-visible-focus-dismissal branch June 22, 2026 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: all components Widespread work has an impact on almost all components. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[focus] Visible focus is not restored after keyboard dismissal in Safari

2 participants