Skip to content
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

[RadioButton][Checkbox] Can't select (highlight) option text #9711

Closed
1 task done
amoedoamorim opened this issue Jan 2, 2018 · 14 comments
Closed
1 task done

[RadioButton][Checkbox] Can't select (highlight) option text #9711

amoedoamorim opened this issue Jan 2, 2018 · 14 comments

Comments

@amoedoamorim
Copy link

amoedoamorim commented Jan 2, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

You should be able to select text from the options labels in order to copy and paste it somewhere else.

Current Behavior

It's not possible to select/highlight the text in the option labels. What happens when you try to click and drag over the text is the option gets selected and nothing else.

Steps to Reproduce (for bugs)

  1. Have a form with Checkbox or RadioButton controls.
  2. Click and drag over the option labels text attempting to select the text
  3. Text does not get selected

Context

Users cannot copy and paste text from option labels in order to google/research/translate or do whatever they may need with such string. Please note that such behavior is possible on Google forms, as per screenshot: https://imgur.com/Fa5B6oO

Your Environment

Tech Version
Material-UI 0.18.7
React 15.6.2
browser Chrome 61.0.3163.91
@oliviertassinari oliviertassinari added v0.x good first issue Great for first contributions. Enable to learn the contribution process. v1.x and removed v0.x labels Jan 2, 2018
@oliviertassinari oliviertassinari changed the title [RadioButton][Checkbox] Can't select (highlight) option text. [RadioButton][Checkbox] Can't select (highlight) option text Jan 2, 2018
@oliviertassinari
Copy link
Member

After benchmarking the other libraries, I think that you are right, they no real motivation for preventing the text selection. We can safely remove this line:
https://github.com/mui-org/material-ui/blob/ddde3c93235f170d2781749a8907005fc12372eb/src/Form/FormControlLabel.js#L24

@mbrookes
Copy link
Member

mbrookes commented Jan 3, 2018

@oliviertassinari I can think of a couple of reasons:

Selecting and then unselecting a checkbox by clicking on the label will highlight the label text (as if it has been double-clicked).

Users with lower motor control or using assitive input devices may find themselves unintentionally selecting the text.

ISTR we had fairly detailed discussion about this when this was introduced on v0, and I believe we are followin best practice.

@amoedoamorim Is free to override this behaviour in his application.

@Chopinsky
Copy link
Contributor

I think alternatively, we can use right click instead of double click to select the checked option, this may not be the most intuitive behavior, but should resolve the concern @mbrookes has raised.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 3, 2018

@mbrookes
Copy link
Member

mbrookes commented Jan 3, 2018

I looked at lots more - it's more like 50/50. The usability concerns are real, but @Chopinsky's requirement is pretty unique. No-one else has asked for this.

He can easily do that for his use case: https://material-ui.com/customization/overrides.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 3, 2018

@mbrookes How is the native <label>, Bootstrap and material-web-components behaving this way not a signal strong enough? Do you have an example of a serious library doing it the other way around?

@mbrookes
Copy link
Member

mbrookes commented Jan 3, 2018

Let's consult the most visited website in the world:
https://www.google.com/preferences

(OTOH, youtube.com does the opposite...)

Here are a few frameworks:

All of these are intentionally applying user-select: none;. Those that aren't may simply not have given it any thought - we don't know that they're intentionally not applying it.

So, the jury is out. I suggest we wait for upvotes rather than changing this to accomodate one user.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 3, 2018

it's more like 50/50.

@mbrookes It's the whole point, there is enough signal out there. It's telling us that being opinionated about the default behavior is wrong. To date, the components I have best-seen implementing accessibility are the native elements. So maybe they are wrong, but I think that we would be better off not taking any bet and relying on the default browser behavior:

@oliviertassinari oliviertassinari removed the good first issue Great for first contributions. Enable to learn the contribution process. label Jan 3, 2018
@mbrookes
Copy link
Member

mbrookes commented Jan 3, 2018

Dude, I can paste just as many screenshots where you can't accidentally select the label, and where we know this is an intentional design choice. We don't know that any of your examples are by design, or whether it just simply hasn't been considered. I posted signal, you posted noise.

I'll grant you native does this - if it didn't, it wouldn't be the default for those libraries that haven't given it any thought, but here's just one of the problems:

kapture 2018-01-03 at 14 26 44

If we're going to follow native, that affects a whole lot more than just user-select.

Further, a primary use-case of Material-UI is mobile apps. Please show me any Material Design (or other) mobile app where you can accidentally select form label text by tapping it twice, or unintentionally swiping?

@oliviertassinari
Copy link
Member

oliviertassinari commented Jan 3, 2018

Further, a primary use-case of Material-UI is mobile apps. Please show me any Material Design (or other) mobile app where you can accidentally select form label text by tapping it twice, or unintentionally swiping?

@mbrookes I would say it's a different concern. I think that the problem should be solved this way with mobile applications. It has to be global:

html {
  user-select: none;
}

@oliviertassinari
Copy link
Member

@mui-org/core-contributors Guys, what do you want to do on this issue? We can't reach a consensus. Either we wait for more user feedback, or you can speak up.

@amoedoamorim
Copy link
Author

Let me add that the Google Forms allow the behaviors to coexist. You can both select the option and highlight the text by clicking on the label. One thing does not exclude the other. Right clicking to select sounds weird and pretty unnatural.

@amoedoamorim
Copy link
Author

Can I ask for help here on how to override this behavior in my app?

I tried passing labelStyle={{ userSelect: 'all' }} to the RadioButton without success.

@oliviertassinari
Copy link
Member

I have no clue with v0.x. The issue was fixed for v1.x.

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

No branches or pull requests

4 participants