You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the modal is closed, the focus returns to the element that triggers the modal. However, when the "Create custom template" modal is closed. the trigger element "Create new template" button disappears, so the focus is lost.
On the other hand, when the "Choose a template" modal is closed, the focus returns correctly to the trigger element ("Change template" button).
Step-by-step reproduction instructions
Activate your screen reader and perform all of the following operations using your keyboard.
Open a post
Sidebar > Post tab
Click the button next to the "Template" label
Open the "Create new template"
Hit the ESC button or click the Cancel button
The dropdown is closed and the focus is lost.
Screenshots, screen recording, code snippet
Create new template
❌ Focus is lost
a344a694061758780b21c0c2e0a9a2fa.mp4
Change template
✅ Focus is not lost
52eccf1d5015896c029f9bc9a82176f0.mp4
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
Please confirm which theme type you used for testing.
Description
Note: This problem is NOT new to WordPress 6.8.
When the modal is closed, the focus returns to the element that triggers the modal. However, when the "Create custom template" modal is closed. the trigger element "Create new template" button disappears, so the focus is lost.
On the other hand, when the "Choose a template" modal is closed, the focus returns correctly to the trigger element ("Change template" button).
Step-by-step reproduction instructions
Activate your screen reader and perform all of the following operations using your keyboard.
Screenshots, screen recording, code snippet
Create new template
❌ Focus is lost
a344a694061758780b21c0c2e0a9a2fa.mp4
Change template
✅ Focus is not lost
52eccf1d5015896c029f9bc9a82176f0.mp4
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Please confirm which theme type you used for testing.