Open Bug 1546366 Opened 2 years ago Updated 2 years ago

Buttons inside the Selection should not highlight its text/content


(Core :: Layout: Form Controls, defect)

Not set




(Reporter: rcaliman, Unassigned)




(3 files)

Button elements are not user-selectable by default.

But when using the programmatic approach with Selection.selectAllChildren(), button elements do get a selection highlight even when explicitly asked to be ignored with CSS -moz-user-select: none.

Google Chrome seems to respect this and does not highlight button elements as selected. This is likely a Gecko implementation issue.

See attached HTML file with test case.

A video demo using the attached test case file showing that Google Chrome ignores both manual and programmatic user selection of button elements.

Additionally, Chrome prevents selection on all elements with CSS user-select: none. Firefox still shows the selection highlight (though it does not copy the highlighted content to the clipboard, as expected).

Priority: -- → P3
No longer blocks: 1538648
See Also: → 1538648

The -moz-user-select property controls only what content the user can select.
It doesn't restrict what script can do, so there's no Selection bug here.

Whether or not the button text should be highlighted when it's inside
the Selection is a different matter.

Component: Selection → Layout: Form Controls
Summary: Selection.selectAllChildren() highlights button elements even with -moz-user-select: none → Buttons inside the Selection should not highlight its text/content

The component has been changed since the priority was decided, so we're resetting it.
For more information, please visit auto_nag documentation.

Priority: P3 → --

It's not clear to me this is a bug at all. FWIW, both Chrome and Safari also highlight the button's text content when it is selected. Mats, should we close this as invalid, or do you think the behavior should be changed?

Flags: needinfo?(mats)

If you click "Select all" and then copy-paste the text then "Button" is excluded even though it's highlighted as selected. That seems confusing. "Button" should either be included in the copied text, or not be highlighted in the first place. I think I'd prefer the latter. We might want to keep the current behavior if it's contenteditable though. In that case, I can currently select/edit the button text, which seems like a feature worth keeping.

Flags: needinfo?(mats)

Chrome highlights "Button" and includes it in the copied text (in my test in comment 5) so that's argument for doing the former I guess.

You need to log in before you can comment on or make changes to this bug.