You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It looks like there may be some issues when copying headings when using either double click (select a word) or triple click (select a paragraph/logical unit). The behavior seems to be different depending on the browser and be related to heading anchor links.
Chrome
When the viewport width is less than 95em (the heading anchor link is at the end of the heading) and double clicking and copying a heading with a single word or the last word of a multiple words heading will inject Section in the clipboard text (I am assuming this is the first word of the heading anchor link screen reader text).
For example, going to this page and double clicking and copying the heading Features will copy FeaturesSection instead of Features. Double clicking and copying the word Principles in the heading Design Principles will copy PrinciplesSection instead of Principles.
Triple clicking is working as expected.
Firefox
When the viewport width is less than 95em (the heading anchor link is at the end of the heading) and triple clicking a heading and copying will inject the entire heading anchor link screen reader text in the clipboard text.
For example, going to this page and triple clicking and copying the heading Features will copy FeaturesSection titled Features instead of Features.
Safari
When the viewport width is less than 95em, double clicking or triple clicking a heading with a single word or the last word of a multiple words heading will visually select the entire page and copying will inject Section in the clipboard text too.
When the viewport width is greater than 95em, triple clicking a heading with a single word or the last word of a multiple words heading will visually select the entire page (the clipboard content is fine in this case).
The selection should visually match what is expected (either a word or an entire heading but never the entire page) and the copied text should match such selection and never contains invisible text.
👀 Current Behavior
The selection can be visually wrong and the copied text can include invisible text.
I wonder if there is some simple solution like a single space between the heading and the anchor link that would avoid the double click case.
I’m less sure about how to solve the triple click case. It surprises me a bit, because the markup is <h2>Heading</h2></a>Section link</a>, so the link is not even within the block heading element. I guess it might be because we use display: inline on the heading at the narrow breakpoint?
I wonder if there is some simple solution like a single space between the heading and the anchor link that would avoid the double click case.
This is one of the idea that I had but did not get the chance yet to actually test it and I wanted to have an issue listing all cases with all browsers so it's easier to test.
📝 Issue Description
It looks like there may be some issues when copying headings when using either double click (select a word) or triple click (select a paragraph/logical unit). The behavior seems to be different depending on the browser and be related to heading anchor links.
Chrome
When the viewport width is less than 95em (the heading anchor link is at the end of the heading) and double clicking and copying a heading with a single word or the last word of a multiple words heading will inject
Section
in the clipboard text (I am assuming this is the first word of the heading anchor link screen reader text).For example, going to this page and double clicking and copying the heading
Features
will copyFeaturesSection
instead ofFeatures
. Double clicking and copying the wordPrinciples
in the headingDesign Principles
will copyPrinciplesSection
instead ofPrinciples
.Triple clicking is working as expected.
Firefox
When the viewport width is less than 95em (the heading anchor link is at the end of the heading) and triple clicking a heading and copying will inject the entire heading anchor link screen reader text in the clipboard text.
For example, going to this page and triple clicking and copying the heading
Features
will copyFeaturesSection titled Features
instead ofFeatures
.Safari
When the viewport width is less than 95em, double clicking or triple clicking a heading with a single word or the last word of a multiple words heading will visually select the entire page and copying will inject
Section
in the clipboard text too.When the viewport width is greater than 95em, triple clicking a heading with a single word or the last word of a multiple words heading will visually select the entire page (the clipboard content is fine in this case).
📋 On which page(s) it occurs
I used https://docs.astro.build/en/concepts/why-astro/#features as an example but this can repro on every pages with headings.
🤔 Expected Behavior
The selection should visually match what is expected (either a word or an entire heading but never the entire page) and the copied text should match such selection and never contains invisible text.
👀 Current Behavior
The selection can be visually wrong and the copied text can include invisible text.
🖥️ Browser
Chrome 125.0.6422.4 - Firefox 125.0.2 - Safari 17.4.1
📄 Additional Information
No response
The text was updated successfully, but these errors were encountered: