-
Notifications
You must be signed in to change notification settings - Fork 949
Label widgets should have a 'for' attribute associating them with their controls. #1737
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
Comments
When we made the change, we looked at various OS guidelines for checkboxes, and every one (Windows, OS X, Gnome, etc.) had the description of the checkbox on the right of the checkbox. That's why we made the change. What are your thoughts? I think we made a mistake originally by putting the description to the left of the checkbox. |
Is the concern about the placement of the description, or about the DOM structure of the checkbox, or something else? |
It's mostly the DOM structure. That forces to use the css hacks to place the label on the left side in our case (Or to overwrite the render method of the CheckboxView). In our case if we have form with every label on the left side, the standalone checkbox looks weird with the label on the right. |
The DOM structure was designed so that the label would be semantically associated with the checkbox for accessibility (screen readers, etc.) and so that clicking on the label could toggle the checkbox (ironically, this was done at a TS sprint: #1346). In fact, we need a better solution for the other description widgets so that their labels are also associated with their controls too. |
While it's certainly true that the standard and default position should have the label on the right, we happen to have an API that requires the opposite. Maybe not commonly enough needed to support. We just wrote our own. No worries if it's considered out of scope. |
Yes, and I'm wondering what about the |
Yes, I think so. We would also need to check to see if that also enables the browser click-on-label-to-toggle-checkbox. If it's semantically equivalent (I think it is), then I wouldn't be opposed to a PR changing the DOM structure to have a label |
(especially if such a PR added it for other description widgets) |
Yes, the |
The model id wouldn't work, since that is shared across views. We also can't use the backbone view id, since that is likely to be duplicated across different notebooks on the same page in JupyterLab. We'd probably need to generate a new view uuid. |
I'll update the description to have label widgets with a |
Description labels should be associated with their controls with the
for
attribute.Original title: The CheckboxWidget could have the ability to render label on the left
According to twosigma/beakerx#6057
Maybe Checkbox widget can have the possibility of rendering it's description as regular
DescriptionWidget
label?The text was updated successfully, but these errors were encountered: