Description
I want to control whether an element is findable/searchable via a browser’s Find function (usually accessed with the Ctrl+F or Cmd+F shortcuts).
Why?
In an interface where meaningful elements accompany or interrupt the flow of running text, users should still be able to interact normally with the text as if those elements were inert.
This JSFiddle shows a sentence interspersed with some annotations. Both the words and annotations are marked up with abutting <span>
tags. (The example is simplified from a real interface I designed.)
Suppose you want to find a sentence within a long annotated paragraph. Most browsers will only find up to a single word (e.g. Th
, This
), but not a string of several words (This sentence
). That behavior is demonstrated below by Chrome 71/Mac:
While this feature would primarily be used by authors to improve user experience in browsers, it could also be used by search engines to ignore certain interface elements when indexing or displaying blurbs on results pages.
Current status
The desired behavior is similar to the existing user-select
property, which controls whether an element is selectable or copyable.
However, the spec does not define whether user-select
affects findability, and if not, does not provide an alternative mechanism for doing so.
CSS Basic User Interface Module Level 4 refers to “findable” once, in the context of generated content:
6.1 Controlling content selection
When generated content in pseudo elements becomes selectable through this mechanism, UAs should also make this content findable through their search function.
CSS Generated Content Module Level 3 refers to “searchable” once, in the context of generated content:
1.1. Accessibility of Generated Content
Generated content should be searchable, selectable, and available to assistive technologies.
Workarounds
Use CSS generated content.
Cons:
- Abuses presentation and removes important semantics
- Not possible to nest or include mixed/phrasing content
Other workarounds:
- Use JavaScript to reposition elements
- Use tables for layout
Questions
- Should
user-select
encompass findability? - If not, should a new control be invented?
- How do findability, selectability, copyability, etc. interact with similar annotation methods, such as ruby annotation or interlinear glosses in linguistics?
- Should the default UA stylesheet for ruby define properties like
user-select
forrt
? - Should a separate issue be created for this?
- Should the default UA stylesheet for ruby define properties like
More examples
-
Example of English text containing a word with a phonetic ruby annotation (JSFiddle):
-
Example of per-letter ruby annotations (taken from a recent presentation):
Further reading
- StackOverflow: HTML: Can you hide/ignore text elements from browser Find (CTRL+F) (▲13, 2013)
- StackOverflow: Is there any way to designate content off-limits to browser's built-in text searching? (▲2, 2015)
- [css-content] Request for note regarding selection, search, and accessibility of generated content (2015) – entire thread
Metadata
Metadata
Assignees
Labels
Type
Projects
Status