Skip to content

chore(order2): improve accessibility#16893

Open
rquartararo wants to merge 8 commits intomainfrom
rquartararo/order2-accessability
Open

chore(order2): improve accessibility#16893
rquartararo wants to merge 8 commits intomainfrom
rquartararo/order2-accessability

Conversation

@rquartararo
Copy link
Member

@rquartararo rquartararo commented Mar 5, 2026

The type of this PR is: chore

This PR solves EMI-3025

@artsy/emerald-devs

Description

  • New address and edit address buttons can now be toggled with the enter key
  • Ability to tab / enter through payment options and billing address form
  • Fixes radio button key down events
  • Adds missing aria labels

@rquartararo rquartararo self-assigned this Mar 5, 2026
open={selectedPaymentMethod === "stripe-card"}
data-testid="stripe-card-collapse"
>
<Box hidden={!isStripeCardSelected} data-testid="stripe-card-collapse">
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced Collaspe with <Box hidden as we are still able to tab items inside a closed Collaspe

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an animation we are losing here or is collapse literally just a disappearing but not properly hidden box?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing any differences in the animation.

Copy link
Contributor

@erikdstock erikdstock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty comprehensive. A few minor questions!

Comment on lines +271 to +279
<RadioGroup
flexDirection="column"
defaultValue={defaultOption}
onSelect={option => {
setSelectedOption(option)
setFieldValue("deliveryOption", option)
checkoutTracking.clickedSelectShippingOption(option.type)
}}
>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 when i was doing the radio change i wondered about some components using this and some not. Are radios always supposed to be wrapped instead of just using onClicks in the radios themselves?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, we should always be wrapping multiple radios in RadioGroup.

expect(screen.getByTestId("stripe-card-collapse")).toHaveStyle({
height: "0px",
})
expect(screen.getByTestId("stripe-card-collapse")).not.toBeVisible()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

open={selectedPaymentMethod === "stripe-card"}
data-testid="stripe-card-collapse"
>
<Box hidden={!isStripeCardSelected} data-testid="stripe-card-collapse">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an animation we are losing here or is collapse literally just a disappearing but not properly hidden box?

you authorize Artsy to save the bank account specified above.`}
>
<Clickable ml={0.5} style={{ lineHeight: 0 }}>
<Clickable aria-label="Direct debit authorization information" ml={0.5} style={{ lineHeight: 0 }}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other areas with this icon on my recent radio groups PR I was able to remove the lineHeight style with no bad effect that I could see. Different context inside the payment step perhaps, or maybe i was missing something.

Comment on lines +39 to +40
as="button"
type="button"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is marked as a button, does it need a clear label or aria-label or aria-labeledby?

Comment on lines +23 to +28
const [radioChild, ...otherChildren] = React.Children.toArray(children)
const clonedRadio = React.cloneElement(radioChild as React.ReactElement, {
onSelect,
selected,
})

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. What is going on here? What happened to our radioChild that we had to replace it with a clone 🦎 👶 ? And why are we throwing _value away? If it's not needed, can we remove the prop?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RadioGroup in Palette manages selection state, but it's expecting Radio as a child, not RadioOptionRow. As for value, this is needed for RadioGroup selection tracking. Basically, by adding RadioOptionRow we are breaking how RadioGroup is intended to be used.

Another option would be to add the RadioOptionRow styles as an option to the component in Palette.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we directly add the styles to Radio and we lose the reusability factor but it seems like a cleaner solution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@erikdstock so I ended up removing RadioOptionRow entirely as it was interfering with the tabing selection. If the grey background on select for radio groups becomes a standard thing across the app we can add it in Palette. Open to other ideas though.

@relativeci
Copy link

relativeci bot commented Mar 6, 2026

#7061 Bundle Size — 8.65MiB (-0.02%).

cd6eeef(current) vs 3b3202e main#7052(baseline)

Warning

Bundle contains 31 duplicate packages – View duplicate packages

Bundle metrics  Change 5 changes Regression 1 regression Improvement 1 improvement
                 Current
#7061
     Baseline
#7052
Regression  Initial JS 2.84MiB(+0.15%) 2.84MiB
No change  Initial CSS 0B 0B
Change  Cache Invalidation 36.86% 19.17%
No change  Chunks 110 110
No change  Assets 113 113
Change  Modules 5516(-0.09%) 5521
Improvement  Duplicate Modules 616(-0.32%) 618
Change  Duplicate Code 4.92%(-0.2%) 4.93%
No change  Packages 250 250
No change  Duplicate Packages 30 30
Bundle size by type  Change 1 change Improvement 1 improvement
                 Current
#7061
     Baseline
#7052
Improvement  JS 8.51MiB (-0.02%) 8.51MiB
No change  Other 152.75KiB 152.75KiB

Bundle analysis reportBranch rquartararo/order2-accessabilityProject dashboard


Generated by RelativeCIDocumentationReport issue

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.

2 participants