Skip to content

Keep keyboard focus visible and clear of the sticky header - #145

Merged
juanfra merged 3 commits into
trunkfrom
claude/eloquent-darwin-65d0e6
Nov 12, 2026
Merged

juanfra merged 3 commits into
trunkfrom
claude/eloquent-darwin-65d0e6

Conversation

@MaggieCabrera

@MaggieCabrera MaggieCabrera commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part of #44. Keyboard focus is now easy to see and stays on screen:

  • Links, menu items and fields get a visible focus ring in every color variation.
  • With Header Sticky, the header no longer covers what you tab or jump to. It scrolls away while focus or a linked section, like the comments, is further down the page, and sticks again when you tab back into it.
  • Nested submenus no longer open off the right edge of the screen.
  • Logged in on small screens, the sticky header no longer leaves a gap above it.

Buttons, the search field and the sticky overlay are covered in #92, #141 and #135.

Screenshots

Before After
Focus ring Before: the focused menu link has the browser's thin orange focus ring After: the focused menu link has a dotted focus ring in the text color
Focus ring, Golden Hour 1c-focus-ring-before-golden-hour After, Golden Hour: a light dotted focus ring on the dark red background
Shift+Tab with Header Sticky Before: with Header Sticky, the focused tag link is hidden under the header After: the header scrolls away and the focused tag link shows in full
Comments link with Header Sticky Before: after following the comments link, the Comments heading is hidden under the header After: the header scrolls away and the Comments heading shows in full
Nested submenus 3a-submenus-before After: the nested submenus open to the left and stay on screen
Sticky header, logged in, below 600px Before: logged in on a phone, a strip of content shows above the sticky header After: the sticky header sits at the very top of the screen

Testing Instructions

  1. Tab through any page, also with a dark color variation. Every link, menu item and field shows a dotted ring.
  2. With Header Sticky, scroll down a long post and press Shift+Tab. The header scrolls away and the focused link stays visible. Keep pressing Shift+Tab until you reach the menu. The header sticks again.
  3. With Header Sticky, click a post's comments link on the blog. The Comments heading isn't covered by the header.
  4. Open the last menu item's nested submenus with the keyboard. They stay on screen.
  5. Logged in and below 600px wide, scroll down. The sticky header sits at the top with no gap.

Checked on the front end, in the Site Editor, and in all color variations.

Use of AI Tools

AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5.5
Used for: Audit, fix, testing and this description. I reviewed the changes.

🤖 Generated with Claude Code

@github-actions github-actions Bot added [Area] Global Styles Issues or PRs that touch theme.json or the base stylesheet. [Area] Patterns Issues or PRs that touch the theme's block patterns. labels Oct 8, 2026
@MaggieCabrera
MaggieCabrera marked this pull request as ready for review October 8, 2026 16:55
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: MaggieCabrera <onemaggie@git.wordpress.org>
Co-authored-by: juanfra <juanfra@git.wordpress.org>
Co-authored-by: rvpatel <ravipatel@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub or WordPress.org user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@juanfra juanfra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @MaggieCabrera, LGTM! I left one comment regarding the sticky header case.

Comment thread style.css Outdated

/* Keep focused elements from scrolling under the sticky header. */
html:has(header.wp-block-template-part > .is-position-sticky) {
scroll-padding-block-start: calc(var(--wp-admin--admin-bar--height, 0px) + 6rem);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume the 6rem is to match the height. That would work if the padding or logo height doesn't change, but it could become an issue if they do. Maybe it's worth documenting?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah /I don't like it either. I changed tactics on dd3d645 what do you think, @juanfra ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @MaggieCabrera! I tried it and I found a side effect. The header unsticks whenever a text field has focus, so clicking the pinned search makes it disappear. The same happens after following a link to the comments for a specific post (for example from the posts list), since the URL keeps the anchor

Probably these things will make it look broken, and the pinned search is really prominent. We could go back to the scroll padding with a generous value and a comment explaining it, since too much padding is harmless. What do you think?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I finally wend ahead and did that. I don't love this solution, but I can't find anything better. Shall we go with this PR as it is now @juanfra ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Agree! not optimal, but for the time being I can't think of something better. Let's merge this one and we can iterate later. Thanks @MaggieCabrera

@rvpatel

rvpatel commented Oct 23, 2026

Copy link
Copy Markdown

Tested on WordPress 7.2-beta1 with this PR on current Ipsum trunk (merges cleanly), single post with the Header Sticky part, Chromium 1200×700, 25 real Tab presses after scrolling down.

  • ✅ 23 of 25 focused elements get the new 2px dotted currentcolor ring and none of them end up under the sticky header.
  • The two exceptions are expected: "Skip to content" (core's skip link, shown above the header) and the "Post Comment" button, which keeps its theme.json ring as the PR intends.

Not tested: the 600px small-screen rule and the admin-bar offset on mobile.

MaggieCabrera and others added 3 commits November 12, 2026 16:46
Draw the focus ring in the text color, 2px dotted, so it keeps its
contrast in every color variation instead of following the system
accent color. Buttons keep the focus state theme.json gives them.

Add scroll padding so focused elements don't land under the sticky
header, and let the header stick to the very top below 600px, where
the admin bar scrolls away.

Part of #44.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The 6rem scroll padding only cleared Header Sticky without a logo, and
any change to the header's padding or logo would break it again. Stop
the header sticking while keyboard focus or an anchor target is
elsewhere on the page, so it can't cover them at any height. Core's
admin bar already sets its own scroll padding.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Unsticking the header hid it whenever a text field had focus, like the
pinned search, and on any page opened with an anchor in its URL. Go
back to scroll padding, as juanfra suggested, with 10rem instead of
6rem: Header Sticky is 113px tall with its 48px logo, and too much
padding is harmless.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaggieCabrera
MaggieCabrera force-pushed the claude/eloquent-darwin-65d0e6 branch from dd3d645 to 110b504 Compare November 12, 2026 15:52
@github-actions github-actions Bot removed the [Area] Patterns Issues or PRs that touch the theme's block patterns. label Nov 12, 2026
@juanfra
juanfra merged commit 0a5efcc into trunk Nov 12, 2026
8 of 10 checks passed
@juanfra
juanfra deleted the claude/eloquent-darwin-65d0e6 branch November 12, 2026 18:04
MaggieCabrera added a commit to MaggieCabrera/wordpress-develop that referenced this pull request Nov 16, 2026
Links, menu items and fields now show a visible focus ring in every color variation. With Header Sticky, the header scrolls away instead of covering what you tab or jump to, and nested submenus no longer open off the right edge of the screen.

Synced from WordPress/ipsum#145.

See #66678.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wporg-sync pushed a commit to WordPress/wordpress-develop that referenced this pull request Nov 17, 2026
This updates Ipsum from `bc2e5af700e28980f251d97f58cf80c72ee50a13` to `d26734ecc1ba178d9c120178ce9d2c48825fc108` on its `trunk` branch.

A full list of changes included in this commit can be found on GitHub: WordPress/ipsum@bc2e5af...d26734e

- Address the review notes from the 7.2 Beta 5 core commit (WordPress/ipsum#216)
- Fix Pullquote custom line height not applying on the front end (WordPress/ipsum#203)
- Fix horizontal scroll caused by long unbroken words in comments (WordPress/ipsum#200)
- Improve design guide defaults and schema descriptions (WordPress/ipsum#193)
- Make the short post date format translatable (WordPress/ipsum#224)
- Fix Details block markers being announced by screen readers (WordPress/ipsum#230)
- Remove the physical left alignment from the page patterns (WordPress/ipsum#226)
- Indent the navigation submenus on the inline start (WordPress/ipsum#225)
- Fix accessible names for overlay navigation (WordPress/ipsum#228)
- Split AGENTS.md so it holds for any copy of the theme (WordPress/ipsum#214)
- Use a logical margin for the comment form checkbox (WordPress/ipsum#231)
- Keep keyboard focus visible and clear of the sticky header (WordPress/ipsum#145)
- Fix accessible name of overlay search form (WordPress/ipsum#239)
- Show a message when the blog and Archive Full have no posts (WordPress/ipsum#238)
- Keep the post date on one line when categories wrap (WordPress/ipsum#205)
- Remove repeated button styles from theme.json (WordPress/ipsum#235)
- Remove unused values from theme.json (WordPress/ipsum#237)
- Make the credit line URL translatable (WordPress/ipsum#240)
- Use single border radius values in theme.json (WordPress/ipsum#236)
- Escape the short post date format instead of ignoring PHPCS (WordPress/ipsum#245)
- Use the Site Title in Footer Centered (WordPress/ipsum#244)
- Keep AGENTS.md about the theme, not the GitHub repository (WordPress/ipsum#247)
- Treat "Written by" as a label before the author name (WordPress/ipsum#246)
- Use Quote blocks for statement patterns and remove text quote mark styles (WordPress/ipsum#232)
  

This commit also includes changes that only exist in core:

- Tests for the `ipsum/get-design-guide` ability are added in `tests/phpunit/tests/theme/ipsumGetDesignGuideAbility.php`, because Ipsum's repository has no PHPUnit setup. On multisite, the tests save global styles as a super admin, since only super admins can save unfiltered global styles.
- `contributing.txt` says Ipsum is developed on GitHub until its 1.0 release, with contributions going through Trac after that. It also drops the note about `style.css` being used when it is newer than `style.min.css`.
- A test message in `ipsumDesignGuide.php` says "do not match" instead of "to not match".

Developed in: #15948

Follow-up to r65366.

Props onemaggie, juanfra, shailu25, iamarinoh, 369work, gziolo, wildworks, suryakantupadhyay, khushalsains, ravipatel, meahadi.
Fixes #66678. See #66352.

git-svn-id: https://develop.svn.wordpress.org/trunk@65549 602fd350-edb4-49c9-b593-d223f7449a82
wporg-sync pushed a commit to WordPress/WordPress that referenced this pull request Nov 17, 2026
This updates Ipsum from `bc2e5af700e28980f251d97f58cf80c72ee50a13` to `d26734ecc1ba178d9c120178ce9d2c48825fc108` on its `trunk` branch.

A full list of changes included in this commit can be found on GitHub: WordPress/ipsum@bc2e5af...d26734e

- Address the review notes from the 7.2 Beta 5 core commit (WordPress/ipsum#216)
- Fix Pullquote custom line height not applying on the front end (WordPress/ipsum#203)
- Fix horizontal scroll caused by long unbroken words in comments (WordPress/ipsum#200)
- Improve design guide defaults and schema descriptions (WordPress/ipsum#193)
- Make the short post date format translatable (WordPress/ipsum#224)
- Fix Details block markers being announced by screen readers (WordPress/ipsum#230)
- Remove the physical left alignment from the page patterns (WordPress/ipsum#226)
- Indent the navigation submenus on the inline start (WordPress/ipsum#225)
- Fix accessible names for overlay navigation (WordPress/ipsum#228)
- Split AGENTS.md so it holds for any copy of the theme (WordPress/ipsum#214)
- Use a logical margin for the comment form checkbox (WordPress/ipsum#231)
- Keep keyboard focus visible and clear of the sticky header (WordPress/ipsum#145)
- Fix accessible name of overlay search form (WordPress/ipsum#239)
- Show a message when the blog and Archive Full have no posts (WordPress/ipsum#238)
- Keep the post date on one line when categories wrap (WordPress/ipsum#205)
- Remove repeated button styles from theme.json (WordPress/ipsum#235)
- Remove unused values from theme.json (WordPress/ipsum#237)
- Make the credit line URL translatable (WordPress/ipsum#240)
- Use single border radius values in theme.json (WordPress/ipsum#236)
- Escape the short post date format instead of ignoring PHPCS (WordPress/ipsum#245)
- Use the Site Title in Footer Centered (WordPress/ipsum#244)
- Keep AGENTS.md about the theme, not the GitHub repository (WordPress/ipsum#247)
- Treat "Written by" as a label before the author name (WordPress/ipsum#246)
- Use Quote blocks for statement patterns and remove text quote mark styles (WordPress/ipsum#232)
  

This commit also includes changes that only exist in core:

- Tests for the `ipsum/get-design-guide` ability are added in `tests/phpunit/tests/theme/ipsumGetDesignGuideAbility.php`, because Ipsum's repository has no PHPUnit setup. On multisite, the tests save global styles as a super admin, since only super admins can save unfiltered global styles.
- `contributing.txt` says Ipsum is developed on GitHub until its 1.0 release, with contributions going through Trac after that. It also drops the note about `style.css` being used when it is newer than `style.min.css`.
- A test message in `ipsumDesignGuide.php` says "do not match" instead of "to not match".

Developed in: WordPress/wordpress-develop#15948

Follow-up to r65366.

Props onemaggie, juanfra, shailu25, iamarinoh, 369work, gziolo, wildworks, suryakantupadhyay, khushalsains, ravipatel, meahadi.
Fixes #66678. See #66352.
Built from https://develop.svn.wordpress.org/trunk@65549


git-svn-id: http://core.svn.wordpress.org/trunk@64622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
arshidkv12 pushed a commit to arshidkv12/wordpress-develop that referenced this pull request Nov 21, 2026
This updates Ipsum from `bc2e5af700e28980f251d97f58cf80c72ee50a13` to `d26734ecc1ba178d9c120178ce9d2c48825fc108` on its `trunk` branch.

A full list of changes included in this commit can be found on GitHub: WordPress/ipsum@bc2e5af...d26734e

- Address the review notes from the 7.2 Beta 5 core commit (WordPress/ipsum#216)
- Fix Pullquote custom line height not applying on the front end (WordPress/ipsum#203)
- Fix horizontal scroll caused by long unbroken words in comments (WordPress/ipsum#200)
- Improve design guide defaults and schema descriptions (WordPress/ipsum#193)
- Make the short post date format translatable (WordPress/ipsum#224)
- Fix Details block markers being announced by screen readers (WordPress/ipsum#230)
- Remove the physical left alignment from the page patterns (WordPress/ipsum#226)
- Indent the navigation submenus on the inline start (WordPress/ipsum#225)
- Fix accessible names for overlay navigation (WordPress/ipsum#228)
- Split AGENTS.md so it holds for any copy of the theme (WordPress/ipsum#214)
- Use a logical margin for the comment form checkbox (WordPress/ipsum#231)
- Keep keyboard focus visible and clear of the sticky header (WordPress/ipsum#145)
- Fix accessible name of overlay search form (WordPress/ipsum#239)
- Show a message when the blog and Archive Full have no posts (WordPress/ipsum#238)
- Keep the post date on one line when categories wrap (WordPress/ipsum#205)
- Remove repeated button styles from theme.json (WordPress/ipsum#235)
- Remove unused values from theme.json (WordPress/ipsum#237)
- Make the credit line URL translatable (WordPress/ipsum#240)
- Use single border radius values in theme.json (WordPress/ipsum#236)
- Escape the short post date format instead of ignoring PHPCS (WordPress/ipsum#245)
- Use the Site Title in Footer Centered (WordPress/ipsum#244)
- Keep AGENTS.md about the theme, not the GitHub repository (WordPress/ipsum#247)
- Treat "Written by" as a label before the author name (WordPress/ipsum#246)
- Use Quote blocks for statement patterns and remove text quote mark styles (WordPress/ipsum#232)
  

This commit also includes changes that only exist in core:

- Tests for the `ipsum/get-design-guide` ability are added in `tests/phpunit/tests/theme/ipsumGetDesignGuideAbility.php`, because Ipsum's repository has no PHPUnit setup. On multisite, the tests save global styles as a super admin, since only super admins can save unfiltered global styles.
- `contributing.txt` says Ipsum is developed on GitHub until its 1.0 release, with contributions going through Trac after that. It also drops the note about `style.css` being used when it is newer than `style.min.css`.
- A test message in `ipsumDesignGuide.php` says "do not match" instead of "to not match".

Developed in: WordPress#15948

Follow-up to r65366.

Props onemaggie, juanfra, shailu25, iamarinoh, 369work, gziolo, wildworks, suryakantupadhyay, khushalsains, ravipatel, meahadi.
Fixes #66678. See #66352.

git-svn-id: https://develop.svn.wordpress.org/trunk@65549 602fd350-edb4-49c9-b593-d223f7449a82
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Area] Global Styles Issues or PRs that touch theme.json or the base stylesheet.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants