Prevent double readout of PM names, by a screenreader, in Dropin

This commit is contained in:
nicholas
2023-06-02 10:18:43 +02:00
parent 01dbe7eea9
commit a59515aceb
2 changed files with 11 additions and 1 deletions

View File

@@ -0,0 +1,5 @@
---
'@adyen/adyen-web': patch
---
Prevent double readout of PM names, by a screenreader, in Dropin.

View File

@@ -112,7 +112,12 @@ class PaymentMethodItem extends Component<PaymentMethodItemProps> {
aria-hidden="true"
/>
<PaymentMethodIcon altDescription={paymentMethod.props.name} type={paymentMethod.type} src={paymentMethod.icon} />
<PaymentMethodIcon
// Only add alt attribute to storedPaymentMethods (to avoid SR reading the PM name twice)
{...(paymentMethod.props.oneClick && { altDescription: paymentMethod.props.name })}
type={paymentMethod.type}
src={paymentMethod.icon}
/>
<PaymentMethodName
displayName={paymentMethod.displayName}