Skip to content

Avoid clipping focus indicator around site title#2714

Closed
techfg wants to merge 1 commit intowithastro:mainfrom
techfg:fix/issue-2696
Closed

Avoid clipping focus indicator around site title#2714
techfg wants to merge 1 commit intowithastro:mainfrom
techfg:fix/issue-2696

Conversation

@techfg
Copy link
Copy Markdown
Contributor

@techfg techfg commented Dec 17, 2024

Description

  • Closes focus:visible outline of site-title not visible #2696
  • What does this PR change? Fix site title focus ring #2704 improved the cosmetic of focus ring in site title, however there were a couple of remaining issues as described here. This PR eliminates the overflow: hidden and applies min-width to ensure the title-wrapper is constrained to available space by flexbox. Additionally, it styles the title text (if its displayed) with elipses providing an improved UI so that text is no longer abruptly cut-off but rather gives an indication that there is more text that just isn't visible. If a logo is present, it will be automatically scaled and therefore doesn't require a container with overflow: hidden. Tested in Edge, Chrome & Firefox.
  • Did you change something visual? A before/after screenshot can be helpful.

With a forced outline of 10px solid green:

Before:
image

After:
image

Important

In performing testing on this PR, I identified other issues related to the way the header is displayed with large images and/or long text. Will create a separate issue to track those. Created #2715.

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Dec 17, 2024

🦋 Changeset detected

Latest commit: 72384d8

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 17, 2024
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 17, 2024

Deploy Preview for astro-starlight ready!

Name Link
🔨 Latest commit 72384d8
🔍 Latest deploy log https://app.netlify.com/sites/astro-starlight/deploys/67611ccf4e74f1000808ff9d
😎 Deploy Preview https://deploy-preview-2714--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.

@delucis
Copy link
Copy Markdown
Member

delucis commented Apr 7, 2025

Hey @techfg! Sorry it took me so long to review this.

Was just testing it now and it looks like this does introduce some layout issues.

If I add a long title with the current version of Starlight it correctly hides behind the other items in the header UI:
Starlight page header with a long site name truncated behind search icon and mobile menu button

But with this branch, the search icon gets pushed behind the menu icon (and eventually off screen when the name is long enough/viewport is narrow enough):
Starlight page header where a long site name pushes the search icon off screen

Given the issue currently only impacts sites that explicitly customize the focus styles AND have long titles, I’ll close this PR for now. Feel free to open a new one if you can figure out a solution that works properly for this scenario.

@techfg
Copy link
Copy Markdown
Contributor Author

techfg commented Apr 7, 2025

Hi @delucis -

Thanks for looking at this. My apologies, this PR originally included the change that was in #2722 but I ended up splitting the PRs since the fix in #2722 was related but also separate issue. This caused the min-width fix from title-wrapper to be lost from this PR which causes the issue you saw.

I've submitted #3058 which is the same as this PR, just with main merged which includes the fix in #2722.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

focus:visible outline of site-title not visible

2 participants