Skip to content

Commit

Permalink
Avoid clipping focus indicator around site title
Browse files Browse the repository at this point in the history
  • Loading branch information
techfg committed Dec 17, 2024
1 parent 3fe09c1 commit 72384d8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/five-radios-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/starlight': patch
---

Fixes display of focus indicator around site title
8 changes: 0 additions & 8 deletions packages/starlight/components/Header.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,6 @@ const shouldRenderSearch =
height: 100%;
}

.title-wrapper {
/* Prevent long titles overflowing and covering the search and menu buttons on narrow viewports. */
overflow: clip;
/* Avoid clipping focus ring around link inside title wrapper. */
padding: 0.25rem;
margin: -0.25rem;
}

.right-group,
.social-icons {
gap: 1rem;
Expand Down
8 changes: 7 additions & 1 deletion packages/starlight/components/SiteTitle.astro
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { siteTitle, siteTitleHref } = Astro.props;
</>
)
}
<span class:list={{ 'sr-only': config.logo?.replacesTitle }}>
<span class:list={[{ 'sr-only': config.logo?.replacesTitle }, 'site-title-text']}>
{siteTitle}
</span>
</a>
Expand All @@ -43,6 +43,12 @@ const { siteTitle, siteTitleHref } = Astro.props;
color: var(--sl-color-text-accent);
text-decoration: none;
white-space: nowrap;
min-width: 0;
}
.site-title-text {
overflow: hidden;
text-overflow: ellipsis;
text-wrap: nowrap;
}
img {
height: calc(var(--sl-nav-height) - 2 * var(--sl-nav-pad-y));
Expand Down

0 comments on commit 72384d8

Please sign in to comment.