summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiDeoo2025-06-13 14:56:11 +0200
committerGitHub2025-06-13 14:56:11 +0200
commite6ea5848b20afbb654fd6684956336491b974dc7 (patch)
tree65b78b8ffe2934e22e5ca1657d60c75553478d37
parent16c1239b36346e84b794fab819d6ad7a9854a244 (diff)
downloadIT.starlight-e6ea5848b20afbb654fd6684956336491b974dc7.tar.gz
IT.starlight-e6ea5848b20afbb654fd6684956336491b974dc7.tar.bz2
IT.starlight-e6ea5848b20afbb654fd6684956336491b974dc7.zip
Fix double click selection issues for heading with a clickable anchor link (#3206)
Co-authored-by: sarah11918 <5098874+sarah11918@users.noreply.github.com> Co-authored-by: ematipico <602478+ematipico@users.noreply.github.com> Co-authored-by: ArmandPhilippot <59021693+ArmandPhilippot@users.noreply.github.com>
-rw-r--r--.changeset/thick-kiwis-attend.md5
-rw-r--r--packages/starlight/style/anchor-links.css3
2 files changed, 8 insertions, 0 deletions
diff --git a/.changeset/thick-kiwis-attend.md b/.changeset/thick-kiwis-attend.md
new file mode 100644
index 00000000..4d606784
--- /dev/null
+++ b/.changeset/thick-kiwis-attend.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/starlight': patch
+---
+
+Fixes a text selection issue for heading with a clickable anchor link when using double click to select text in Chrome and Safari.
diff --git a/packages/starlight/style/anchor-links.css b/packages/starlight/style/anchor-links.css
index 72b26a15..193d3f71 100644
--- a/packages/starlight/style/anchor-links.css
+++ b/packages/starlight/style/anchor-links.css
@@ -91,6 +91,9 @@ how we do it.
/* Prevent double or triple clicks from potentially selecting the anchor link a11y text. */
-webkit-user-select: none;
user-select: none;
+ /* Prevent double clicks on the last word (or single word) of a heading to include an extra new
+ line in Chrome and Safari. */
+ display: inline-flex;
}
/* Increase clickable area for anchor links with a pseudo element that doesnโ€™t impact layout. */