From f6eb1d5a776b007bec0f4b5fd7b160851daac9fc Mon Sep 17 00:00:00 2001 From: HiDeoo Date: Thu, 24 Apr 2025 17:15:49 +0200 Subject: Fix double/triple click selection issues for heading with a clickable anchor link (#3140) --- .changeset/clean-yaks-drive.md | 5 +++++ packages/starlight/style/anchor-links.css | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/clean-yaks-drive.md diff --git a/.changeset/clean-yaks-drive.md b/.changeset/clean-yaks-drive.md new file mode 100644 index 00000000..8b049abf --- /dev/null +++ b/.changeset/clean-yaks-drive.md @@ -0,0 +1,5 @@ +--- +'@astrojs/starlight': patch +--- + +Fixes a text selection issue for heading with a clickable anchor link when using double or triple click to select text. diff --git a/packages/starlight/style/anchor-links.css b/packages/starlight/style/anchor-links.css index 04749443..72b26a15 100644 --- a/packages/starlight/style/anchor-links.css +++ b/packages/starlight/style/anchor-links.css @@ -88,6 +88,9 @@ how we do it. position: relative; /* Move the anchor link over the heading element’s end-of-line padding. */ margin-inline-start: calc(-1 * var(--sl-anchor-icon-size)); + /* Prevent double or triple clicks from potentially selecting the anchor link a11y text. */ + -webkit-user-select: none; + user-select: none; } /* Increase clickable area for anchor links with a pseudo element that doesn’t impact layout. */ -- cgit