Skip to content

how should selecting text interact with toggle-visibility? #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
dbaron opened this issue Oct 5, 2022 · 3 comments
Open

how should selecting text interact with toggle-visibility? #42

dbaron opened this issue Oct 5, 2022 · 3 comments

Comments

@dbaron
Copy link
Collaborator

dbaron commented Oct 5, 2022

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
Copy link
Collaborator Author

dbaron commented Oct 6, 2022

Oh, and according to @vmpstr, the important aspect of selection behavior with content-visibility: auto is that having a selection in something that is content-visibility: auto prevents its contents from being skipped when it is scrolled offscreen. This matches the spec definition of "relevant to the user".

This makes me think the spec may need somewhat more careful wording, since I think having selected text or contents in the top layer shouldn't prevent (for example) switching away from a tab... but switching away from the tab should probably change the selection or the top-layer-ness. The current "starts being relevant to the user" perhaps tries to cover that, but "starts" could perhaps be ambiguous.

@mirisuzanne
Copy link
Collaborator

I agree that I would generally expect hidden content to not be selected or copied, and I would not want selected text to keep me from changing tabs.

@tabatkins
Copy link
Owner

Yup, agreed on all counts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants