Skip to content
Closed
Show file tree
Hide file tree
Changes from 19 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
2 changes: 2 additions & 0 deletions src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5898,7 +5898,9 @@ const CONST = {

ACCESSIBILITY_LABELS: {
COLLAPSE: 'Collapse',
COLLAPSED: 'Collapsed',
EXPAND: 'Expand',
EXPANDED: 'Expanded',
ERROR: 'Error',
},

Expand Down
5 changes: 5 additions & 0 deletions src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ type ButtonProps = Partial<ChildrenProps> &
/** Accessibility label for the component */
accessibilityLabel?: string;

/** Accessibility hint for the component */
accessibilityHint?: string;

/** The text for the button label */
text?: string;

Expand Down Expand Up @@ -284,6 +287,7 @@ function Button({
id = '',
testID = undefined,
accessibilityLabel = '',
accessibilityHint = undefined,
link = false,
isContentCentered = false,
isPressOnEnterActive,
Expand Down Expand Up @@ -532,6 +536,7 @@ function Button({
onHoverIn={!isDisabled || !shouldStayNormalOnDisable ? () => setIsHovered(true) : undefined}
onHoverOut={!isDisabled || !shouldStayNormalOnDisable ? () => setIsHovered(false) : undefined}
sentryLabel={sentryLabel}
accessibilityHint={accessibilityHint}
>
{shouldBlendOpacity && <View style={[StyleSheet.absoluteFill, buttonBlendForegroundStyle]} />}
{renderContent()}
Expand Down
6 changes: 6 additions & 0 deletions src/components/ButtonWithDropdownMenu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ function ButtonWithDropdownMenu<IValueType>({ref, ...props}: ButtonWithDropdownM
);
const splitButtonWrapperStyle = isSplitButton ? [styles.flexRow, styles.justifyContentBetween, styles.alignItemsCenter] : {};
const isTextTooLong = customText && customText?.length > 6;
const accessibilityExpandState = isMenuVisible ? CONST.ACCESSIBILITY_LABELS.EXPANDED : CONST.ACCESSIBILITY_LABELS.COLLAPSED;
const accessibilityLabel = `${accessibilityExpandState}, ${customText}`;

const handlePress = useCallback(
(event?: GestureResponderEvent | KeyboardEvent) => {
Expand Down Expand Up @@ -195,6 +197,8 @@ function ButtonWithDropdownMenu<IValueType>({ref, ...props}: ButtonWithDropdownM
iconRightFill={hasError ? theme.icon : undefined}
iconRightHoverFill={hasError ? theme.icon : undefined}
sentryLabel={sentryLabel}
accessibilityLabel={!isSplitButton ? accessibilityLabel : undefined}
accessibilityHint=""
/>

{isSplitButton && (
Expand All @@ -213,6 +217,8 @@ function ButtonWithDropdownMenu<IValueType>({ref, ...props}: ButtonWithDropdownM
innerStyles={[styles.dropDownButtonCartIconContainerPadding, innerStyleDropButton, isButtonSizeSmall && styles.dropDownButtonCartIcon]}
enterKeyEventListenerPriority={enterKeyEventListenerPriority}
sentryLabel={sentryLabel}
accessibilityLabel={accessibilityLabel}
accessibilityHint=""
>
<View style={[styles.dropDownButtonCartIconView, innerStyleDropButton]}>
<View style={[success ? styles.buttonSuccessDivider : styles.buttonDivider]} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ function NativeGenericPressable({ref, ...props}: PressableProps) {
<GenericPressable
focusable
accessible
accessibilityHint={props.accessibilityHint ?? props.accessibilityLabel}
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
accessibilityHint={props.accessibilityHint ?? props.accessibilityLabel}
ref={ref}
/>
);
Expand Down
Loading