- From: Psychpsyo (Cameron) via GitHub <noreply@w3.org>
- Date: Sat, 02 Aug 2025 19:13:39 +0000
- To: public-css-archive@w3.org
Psychpsyo has just created a new issue for https://github.com/w3c/csswg-drafts: == [css-ui][css-pseudo][selection-api] Interop issue: Selecting the default quotes on <q> elements (+implications for selectable pseudo-elements) == The <q> element, by default, has a ::before and an ::after with quotes in it. In all browsers, these do not visually get selected when selecting the text around them. This is because pseudo-elements are currently not selectable in practice, since there's spec issues to resolve regarding copyability and DOM APIs. (see [user-select](https://drafts.csswg.org/css-ui/#propdef-user-select)) In Firefox however, when actually querying the selected text (`document.getSelection().toString()`) or copying it with Ctrl+C, the resulting string does include quotes. However, this is not the quotes from the pseudos. Any (even partially) selected <q> element causes the copied text to include a `"` (U+0022 Quotation Mark) before and after the text from the <q> element. This ignores nesting level and Chrome does not do it at all. This seems like useful functionality and I think it might work as rough precedent for how selectable pseudos ought to be handled. (i.e. They'd be entirely invisible to DOM APIs and just magically inserted into the stringified Selection) Though the inclusion around partial selections feels weird. Maybe this could get a new CSS property? (`select-generated-content: always | in-range` where `in-range` would only include them in a selection if the relevant element boundary is included) Selections starting or ending inside ::before or ::after pseudos could just be placed around the originating element from the perspective of JS APIs. Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12565 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Saturday, 2 August 2025 19:13:41 UTC