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

Add radio role and aria checked state to color checkboxes #2331

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

RoyEJohnson
Copy link
Contributor

@RoyEJohnson RoyEJohnson commented Aug 20, 2024

DISCO-323
Leaving the type as checkbox retained the functionality. Adding the role takes care of the accessibility.

@RoyEJohnson RoyEJohnson requested a review from a team as a code owner August 20, 2024 16:54
@RoyEJohnson RoyEJohnson requested a review from jivey August 20, 2024 16:54
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-qgzd5d August 20, 2024 16:54 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-qgzd5d August 20, 2024 17:02 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-qgzd5d August 21, 2024 22:26 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-qgzd5d August 22, 2024 16:41 Inactive
@@ -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} />
Copy link
Member

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...

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

@RoyEJohnson RoyEJohnson requested a review from jivey September 3, 2024 17:46
Copy link
Member

@jivey jivey left a 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.

@RoyEJohnson RoyEJohnson force-pushed the make-color-picker-a-radio-group branch 3 times, most recently from 9e36a32 to cf1cd3f Compare September 10, 2024 14:32
@RoyEJohnson
Copy link
Contributor Author

I have added a trash icon to the color picker.
I ran into CI issue with our use of actions/upload-artifact v2. Tom suggested I simply remove those bits, so I did.

@RoyEJohnson RoyEJohnson requested a review from jivey September 10, 2024 14:47
Copy link
Member

@jivey jivey left a 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}
Copy link
Member

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?

Copy link
Contributor Author

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.

@RoyEJohnson RoyEJohnson requested a review from jivey September 12, 2024 16:41
@Malar-Natarajan Malar-Natarajan temporarily deployed to rex-web-make-color-pick-fgae9u September 17, 2024 16:15 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 17, 2024 21:38 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 17, 2024 22:02 Inactive
@RoyEJohnson RoyEJohnson force-pushed the make-color-picker-a-radio-group branch from d8aca6a to 766463c Compare September 18, 2024 20:33
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 18, 2024 20:34 Inactive
@RoyEJohnson RoyEJohnson force-pushed the make-color-picker-a-radio-group branch from 766463c to 1c4033b Compare September 19, 2024 11:38
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 19, 2024 11:38 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 19, 2024 15:55 Inactive
@RoyEJohnson RoyEJohnson force-pushed the make-color-picker-a-radio-group branch from 71089be to f30081b Compare September 23, 2024 16:48
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 23, 2024 16:48 Inactive
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 23, 2024 18:48 Inactive
[DISCO-323]
Leaving the type as checkbox retained the functionality. Adding the role takes care of the accessibility.
@RoyEJohnson RoyEJohnson force-pushed the make-color-picker-a-radio-group branch from 954df4b to f3b4f94 Compare September 25, 2024 14:59
@TomWoodward TomWoodward temporarily deployed to rex-web-make-color-pick-fgae9u September 25, 2024 15:00 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants