Re: [css-content] Request for note regarding selection, search, and accessibility of generated content

> On 24 Nov 2015, at 00:48, Rodney Rehm <mail+w3list@rodneyrehm.de> wrote:
> 
> 
>>> On 23 Nov 2015, at 03:37, Florian Rivoal <florian@rivoal.net
>>> wrote:
>>> 
>>> By default (as per the legacy behavior), generated content in pseudo elements is not searchable/copyable/selectable. However, using the user-select property on the pseudos could make them searchable/copyable/selectable.
>> 
>> That doesn’t sound like a viable solution; it’s essentially the same as having to 
>> add box-sizing: border-box; to everything.
>> 
>> Are there cases where it is preferable the user cannot select text in generated content?
>> And do those outnumber the cases where it’s preferable they can select it?
> 
> If the existing specification never actually declared generated content to be non-selectable, making it selectable by default should be fine. I don’t expect the majority of websites and developers to even notice this change. And if it does prove to be a problem, one can always disable text-selection using the user-select property. Allowing the text to be selected feels like the sane default.

Allowing text to by selected by default on generated content is problematic for 2 reasons:

- Spec or no spec, it hasn't worked this way in any browser, so we'd have compat problems. For example, there are plenty of sites out there with "something::after { content: "."; /*...*/ }" as part of a clearfix. You don't want this, and all the other decorative things that have been injected in web page using ::before and ::after over the ages to become selectable all of a sudden.

- Making generated content somewhat worse than including things in the DOM provides desirable incentives for authors, as we do want to encourage them to put things in the DOM rather than in generated content when they can.

/Florian

Received on Tuesday, 24 November 2015 00:36:50 UTC