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
GrafanaUI: Add indeterminate state to Checkbox #67312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏🏻
- [ ] B-series | ||
- [ ] C-series | ||
|
||
The indeterminate state of the checkbox should be used when there is a group of child checkboxes that are in a mix of checked and unchecked states. For instance when you have a list of checkboxes representing the columns of a table, and you want to allow the user to select which columns to display. If some of the columns are checked, and some are unchecked, then the parent checkbox should be in an indeterminate state. If all the columns are checked, then the parent should be checked. If none of the columns are checked, then the parent should be unchecked. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would mention here that <Checkbox checked indeterminate />
is discouraged as a checkboxs emit boolean values which can only ever be TRUE or FALSE, and if something is partially true, then it is false.
right: 3px; | ||
top: calc(50% - 1.5px); | ||
height: 3px; | ||
border: solid ${theme.colors.primary.contrastText}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoaoSilvaGrafana If I get rid of this border the indeterminate state
looks good, otherwise, it looks like the screenshots I added to my comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Firefox! :shakes-fist:
Thanks for checking Laura 😄 I will see how to solve this, that line is there solving another edge case problem...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to help! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this feature?
Adds an indeterminate state to checkboxes. It picks up from this PR #65463 and adds some more styling to it, including disabled.
Why do we need this feature?
Indeterminate is a visual only state typically used to show that 'sub options' are in a mixed state. Setting
indeterminate={true}
on a checkbox does not affect the value of the checkbox, but only the visual appearance.Who is this feature for?
Everyone
Which issue(s) does this PR fix?:
Fixes #63335
Special notes for your reviewer:
Regarding a question on if we need to set indeterminate property to the checkbox via JS, I don't believe we need it, at least from a a11y perspective all that is required is that we set
aria-checked='mixed'
.Please check that: