-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add radio role and aria checked state to color checkboxes #2331
base: main
Are you sure you want to change the base?
Conversation
@@ -48,7 +48,7 @@ const ColorButton = styled(({className, size, style, ...props}: ColorButtonProps | |||
component={<label />} | |||
className={className} | |||
> | |||
<input type='checkbox' {...props} /> | |||
<input type='checkbox' role='radio' aria-checked={props.checked} {...props} /> |
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.
Wouldn't a radio type work? From what I can tell, once one is checked, there is no unchecked state, so this seems like a clear case to me that these should be radios...
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.
That's exactly why a radio doesn't work: we need to be able to deselect the selected color to remove the highlight.
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.
Sorry I missed your follow up message last week. Doesn't role="radio"
mean the screenreader won't be informed there is a possibility to uncheck it? Usually re-checking a checked radio does nothing, so this seems like a hidden, surprise interaction. With the uncheck-deletion only occurring on unsaved highlights, it feels like we should move that interaction to a Cancel button instead. Maybe we can check with LA about this?
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.
It's definitely worth asking LA about.
Another approach that worked (I noted on the issue card) was to change the type of the selected radio item to checkbox. But that also seemed weird.
Probably the right answer is a remove-highlight button.
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.
(Just summarizing our discussion in a review comment.) Based on the card comments, it looks like VC thinks a remove highlight button it could work. Like you mentioned, we can also check with LA about some other solution that keeps the existing design.
9e36a32
to
cf1cd3f
Compare
I have added a trash icon to the color picker. |
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.
The trash can seems great, just wondering about it not doing anything in some states.
{ props.size === 'small' ? null : | ||
<TrashButton | ||
size={props.size} | ||
onClick={() => 'onRemove' in props && props.onRemove ? props.onRemove() : null} |
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.
This is working great in the scenario we discussed. But should it also work before color selection, and after note creation? When I was testing those, nothing happened when I clicked the button. Maybe we just hide it if onRemove isn't set?
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 had to fiddle with useOnRemove so it would return null instead of a function that did nothing, but that makes it much less confusing to only have the trash can show up when it's functional.
d8aca6a
to
766463c
Compare
766463c
to
1c4033b
Compare
71089be
to
f30081b
Compare
[DISCO-323] Leaving the type as checkbox retained the functionality. Adding the role takes care of the accessibility.
954df4b
to
f3b4f94
Compare
DISCO-323
Leaving the type as checkbox retained the functionality. Adding the role takes care of the accessibility.