Skip to content

[css-ui?] Add control over findability of text #9726

@emilio

Description

@emilio

Some rendering techniques like GitHub's code view rely on a color: transparent textarea with all the content overlaid on top of the actual rendered content.

In order to avoid find in browsers from returning each result twice, they go through hoops to prevent finding the actual rendered text, see:

Firefox allows you to find pseudo-elements, they end up working around it harder by adding a per-node pseudo-element, which ends up causing performance issues as described in here:

Doing the maybe obvious solution of "don't find transparent text just like you don't find text with visibility: hidden" is not really possible, because:

  • That same transparent text approach is used elsewhere to make stuff findable (a concrete example of this is pdf.js).
  • Transparent text might still be visible IIRC, with something like background-clip: text.

A reasonable solution could be to offer authors control over find-ability of text, just like we do for selection via e.g. user-select.

So a strawman proposal to get discussion started could be a property with a syntax like:

  user-find: auto | none

Does that seem reasonable? It should be extensible in the future if we want to, but that seems like a consistent starting point to me.

Another question is: Should this property be inherited? user-select isn't, but user-select is really weird. I think it'd be simpler if this one was inherited, but open to other ideas.

cc @josepharhar @mfreed7 @rniwa @fantasai @frivoal

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions