Skip to content

Commit

Permalink
create const values for accessibility roles
Browse files Browse the repository at this point in the history
  • Loading branch information
robertKozik committed Jun 7, 2023
1 parent 014eb8b commit 5cd97a3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -2446,6 +2446,13 @@ const CONST = {
EXPENSIFY_LOGO_SIZE_RATIO: 0.22,
EXPENSIFY_LOGO_MARGIN_RATIO: 0.03,
},
ACCESSIBILITY_ROLE: {
BUTTON: 'button',
LINK: 'link',
MENUITEM: 'menuitem',
TEXT: 'text',
RADIO: 'radio',
},
};

export default CONST;
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as DeviceCapabilities from '../../libs/DeviceCapabilities';
import styles from '../../styles/styles';
import withWindowDimensions, {windowDimensionsPropTypes} from '../withWindowDimensions';
import {propTypes as anchorForCommentsOnlyPropTypes, defaultProps as anchorForCommentsOnlyDefaultProps} from './anchorForCommentsOnlyPropTypes';
import CONST from '../../CONST';

const propTypes = {
/** Press in handler for the link */
Expand Down Expand Up @@ -60,7 +61,7 @@ const BaseAnchorForCommentsOnly = (props) => {
onPress={linkProps.onPress}
onPressIn={props.onPressIn}
onPressOut={props.onPressOut}
accessibilityRole="link"
accessibilityRole={CONST.ACCESSIBILITY_ROLE.LINK}
accessibilityLabel={props.href}
>
<Tooltip text={props.href}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/LHNOptionsList/OptionRowLHN.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const OptionRowLHN = (props) => {
props.isFocused ? styles.sidebarLinkActive : null,
hovered && !props.isFocused ? props.hoverStyle : null,
]}
accessibilityRole="button"
accessibilityRole={CONST.ACCESSIBILITY_ROLE.BUTTON}
accessibilityLabel={props.translate('accessibilityHints.navigatesToChat')}
>
<View
Expand Down
2 changes: 1 addition & 1 deletion src/components/MenuItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ const MenuItem = (props) => {
]}
disabled={props.disabled}
ref={props.forwardedRef}
accessibilityRole="menuitem"
accessibilityRole={CONST.ACCESSIBILITY_ROLE.MENUITEM}
accessibilityLabel={props.title}
>
{({hovered, pressed}) => (
Expand Down

0 comments on commit 5cd97a3

Please sign in to comment.