Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix site title focus ring #2704

Merged
merged 2 commits into from
Dec 16, 2024
Merged

Fix site title focus ring #2704

merged 2 commits into from
Dec 16, 2024

Conversation

delucis
Copy link
Member

@delucis delucis commented Dec 16, 2024

Description

Examples in Firefox, Safari, and Chrome respectively (macOS):

Browser Before After
Firefox Starlight site title with only one edge of the focus ring visible Starlight site title with focus ring fully visible
Safari Starlight site title with only one edge of the focus ring visible Starlight site title with focus ring fully visible
Chrome Starlight site title with only one edge of the focus ring visible Starlight site title with focus ring fully visible

Copy link

changeset-bot bot commented Dec 16, 2024

🦋 Changeset detected

Latest commit: 8bcbcb6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@astrojs/starlight Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the 🌟 core Changes to Starlight’s main package label Dec 16, 2024
Copy link

netlify bot commented Dec 16, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 8bcbcb6
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/676017aa55ea8e0008a494e2
😎 Deploy Preview https://deploy-preview-2704--astro-starlight.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
1 paths audited
Performance: 100 (no change from production)
Accessibility: 100 (no change from production)
Best Practices: 100 (no change from production)
SEO: 100 (no change from production)
PWA: -
View the detailed breakdown and full score reports

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

@astrobot-houston
Copy link
Collaborator

size-limit report 📦

Path Size
/index.html 6.93 KB (-0.02% 🔽)
/_astro/*.js 21.19 KB (0%)
/_astro/*.css 13.75 KB (+0.08% 🔺)

Copy link
Member

@HiDeoo HiDeoo left a comment

Choose a reason for hiding this comment

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

Looks great to me, also tested locally without replacesTitle or a logo and it works as expected 👍

@delucis delucis added the 🌟 patch Change that triggers a patch release label Dec 16, 2024
@delucis delucis merged commit fd16470 into main Dec 16, 2024
16 checks passed
@delucis delucis deleted the dx-1506/fix-title-focus branch December 16, 2024 16:05
@astrobot-houston astrobot-houston mentioned this pull request Dec 16, 2024
@techfg
Copy link
Contributor

techfg commented Dec 16, 2024

Thanks for the quick response @delucis!

@techfg
Copy link
Contributor

techfg commented Dec 16, 2024

@delucis -

Unfortunately, I came across an issue when doing some testing based on this PR.

By default, I believe most browsers will apply an outline-width of 1px via user-agent. However, outline can be customized, and often is (see the recommendation in #2693 for doing it with Starlight itself). More importantly, it can be overridden by the user via user stylesheets/settings.

When the outline is customized to a larger width, the outline does not display consistently on all borders for site-title.

I've updated the repro to Starlight v0.30.2 and to use a 10px width and, while an exaggerated width, it easily demonstrates the issue. Once you reach 4px (which corresponds with the padding/margin you applied, possibly to compensate for this exact issue), the problem becomes very visible. Applying an overflow of unset or visible to title-wrapper resolves the issue. I'm assuming the overflow is in-place to constrain the content, likely images and long titles per the comment, within the title but possibly there is another way to accomplish without using overflow.

Note

When the viewport is < 1400px, the outline on site-title is even smaller on the right then the picture below. The picture below was taken at > 1400px. In short, as the viewport width changes, the outline width changes on site-title.

image

Another scenario is when there is really long title text - in this case, the right side of the outline is completely hidden

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🌟 core Changes to Starlight’s main package 🌟 patch Change that triggers a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

focus:visible outline of site-title not visible
4 participants