summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiDeoo2025-04-24 17:15:49 +0200
committerGitHub2025-04-24 17:15:49 +0200
commitf6eb1d5a776b007bec0f4b5fd7b160851daac9fc (patch)
treefd5257d209edcff95fd6e2ae876b98a19b6709cc
parentdc8b6d5561eb90be9d31396ed1dc8f8258c9cbf7 (diff)
downloadIT.starlight-f6eb1d5a776b007bec0f4b5fd7b160851daac9fc.tar.gz
IT.starlight-f6eb1d5a776b007bec0f4b5fd7b160851daac9fc.tar.bz2
IT.starlight-f6eb1d5a776b007bec0f4b5fd7b160851daac9fc.zip
Fix double/triple click selection issues for heading with a clickable anchor link (#3140)
-rw-r--r--.changeset/clean-yaks-drive.md5
-rw-r--r--packages/starlight/style/anchor-links.css3
2 files changed, 8 insertions, 0 deletions
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. */