css-toggle icon indicating copy to clipboard operation
css-toggle copied to clipboard

how should selecting text interact with toggle-visibility?

Open dbaron opened this issue 1 year ago • 3 comments

The spec for toggle-visibility currently says that it works the same way as content-visibility: auto except that it's tied to the state of a toggle instead of to being onscren.

One case where I was wondering whether it should be different from content-visibility: auto is for text selection. In particular, in my current implementation, I introduced a code difference from content-visibility: auto where toggle-visibility does not react to selection. However, I'm actually not sure what this code difference corresponds to, since I get the same text selection behavior with or without the code difference. (See the list of activation reasons in the Chromium code.)

That said, I think it's perhaps worth raising the question of what the expected behavior of selection (and copy/paste) with toggle-visibility is. The current thing that happens in the Chromium implementation is that:

  • selecting text with the mouse or keyboard simply skips over things with toggle visibility (e.g., if I'm using arrow keys for selection, it skips quickly as though the hidden thing were not there, rather than requiring an arrow press for each character in that text)
  • copying and pasting the text excludes the parts hidden by toggle-visibility (at least for a plain text paste; I didn't test an HTML paste)

I'm curious if this matches expectations for selection.

cc @mirisuzanne @tabatkins @stubbornella

dbaron avatar Oct 05 '22 14:10 dbaron