whatwg/html

Make <summary> unselectable by default

xfq opened this issue · 5 comments

xfq commented

When expanding/collapsing the <details> element, it's really easy to select the text in the <summary> element accidentally when expanding and collapsing a section quickly (just for a quick short look at the section, for example), which is annoying.

Personally, I'd like to see the selection of the <summary> element disabled by default, but I'm also glad to hear other people's comments on this suggestion.

Bugs in browsers:

xfq commented

There are also some discussions in w3c/i18n-drafts#123.

I don't think we use user-select (defined at https://drafts.csswg.org/css-ui-4/#content-selection) currently for anything and I'm not quite convinced we should start. Unless there's evidence this is a widespread problem this seems like a problem easily addressed by a browser extension.

I think this might be in the realm of browser UX, not spec. E.g. a browser could require dragging further than normal to start a selection from inside a summary element. The actual process of mouse down/move/up translation to selection is the problem here, not selection itself. (For example, we should not prevent keyboard selection or "Select all" or dragging to select everything in a large swathe of the page which contains a single details/summary.) And that translation process is a browser UX design issue, not a spec issue.

@xfq In w3c/i18n-drafts#123 you noted that links don't have this problem. What's different about links vs summary that makes one a problem and the other not? And could that difference be implemented in UAs, instead of making them unselectable?

(Fwiw I agree with @domenic and @annevk that disabling selection isn't the right solution here, improving browser UX is.)

tophf commented

The unwanted selection appears because of the short interval between the two clicks, which is treated by the browser as a double-click, not because the cursor moves. Indeed this looks like a bug/omission in browsers for not accounting for this scenario.