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

chore: [IOBP-1190] Add a11y announcement inside the payment method details screen #6776

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions locales/en/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4072,6 +4072,9 @@
}
},
"details": {
"a11y": {
"announce": "Payment method details"
},
"payPal": {
"banner": {
"title": "Do you want to pay in 3?",
Expand Down
3 changes: 3 additions & 0 deletions locales/it/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -4072,6 +4072,9 @@
}
},
"details": {
"a11y": {
"announce": "Dettaglio metodo di pagamento"
},
"payPal": {
"banner": {
"title": "Vuoi pagare in 3 rate?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ import {
} from "@pagopa/io-app-design-system";

import { PropsWithChildren, useState } from "react";
import { ColorValue, LayoutChangeEvent, StyleSheet, View } from "react-native";
import {
AccessibilityInfo,
ColorValue,
LayoutChangeEvent,
StyleSheet,
View
} from "react-native";
import Animated, {
useAnimatedRef,
useAnimatedScrollHandler,
Expand All @@ -21,6 +27,8 @@ import {
PaymentCard,
PaymentCardComponentProps
} from "../../common/components/PaymentCard";
import { useOnFirstRender } from "../../../../utils/hooks/useOnFirstRender";
import I18n from "../../../../i18n";

type Props = {
card: PaymentCardComponentProps;
Expand Down Expand Up @@ -54,6 +62,7 @@ const PaymentsMethodDetailsBaseScreenComponent = ({
contentOffsetY: translationY,
triggerOffset: titleHeight
},
ignoreAccessibilityCheck: true,
enableDiscreteTransition: true,
animatedRef: animatedScrollViewRef
});
Expand All @@ -70,6 +79,12 @@ const PaymentsMethodDetailsBaseScreenComponent = ({
}
};

useOnFirstRender(() => {
AccessibilityInfo.announceForAccessibility(
I18n.t("features.payments.details.a11y.announce")
);
});

return (
<Animated.ScrollView
onScroll={scrollHandler}
Expand Down
6 changes: 5 additions & 1 deletion ts/hooks/useHeaderSecondLevel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useStatusAlertProps } from "./useStatusAlertProps";

type SpecificHookProps = {
canGoBack?: boolean;
ignoreAccessibilityCheck?: boolean;
/* On the surface, this prop seems useless, but it's used
to programmatically hide the header.
See PR#5795 for more details. */
Expand Down Expand Up @@ -104,6 +105,7 @@ export const useHeaderSecondLevel = ({
variant,
backgroundColor,
enableDiscreteTransition,
ignoreAccessibilityCheck,
animatedRef
}: HeaderSecondLevelHookProps) => {
const alertProps = useStatusAlertProps();
Expand Down Expand Up @@ -197,18 +199,20 @@ export const useHeaderSecondLevel = ({
const headerComponentProps = useMemo(
() => ({
title,
ignoreAccessibilityCheck,
...graphicProps,
...backProps,
...helpProps
}),
[title, graphicProps, backProps, helpProps]
[title, ignoreAccessibilityCheck, graphicProps, backProps, helpProps]
) as HeaderProps;

useLayoutEffect(() => {
navigation.setOptions({
header: () => (
<HeaderSecondLevel
{...headerComponentProps}
ignoreAccessibilityCheck
transparent={transparent}
/>
),
Expand Down
Loading