Skip to content

Commit

Permalink
review changes + added accessibility labels
Browse files Browse the repository at this point in the history
  • Loading branch information
Skalakid committed Jun 27, 2023
1 parent 56b01f4 commit a63eee4
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 6 deletions.
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1024,7 +1024,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Airship: c70eed50e429f97f5adb285423c7291fb7a032ae
AirshipFrameworkProxy: 7bc4130c668c6c98e2d4c60fe4c9eb61a999be99
boost: a7c83b31436843459a1961bfd74b96033dc77234
boost: 57d2868c099736d80fcd648bf211b4431e51a558
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 5189b271737e1565bdce30deb4a08d647e3f5f54
FBLazyVector: ff54429f0110d3c722630a98096ba689c39f6d5f
Expand Down Expand Up @@ -1067,7 +1067,7 @@ SPEC CHECKSUMS:
Permission-LocationWhenInUse: 3ba99e45c852763f730eabecec2870c2382b7bd4
Plaid: 7d340abeadb46c7aa1a91f896c5b22395a31fcf2
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
RCT-Folly: 0080d0a6ebf2577475bda044aa59e2ca1f909cda
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
RCTRequired: e9e7b8b45aa9bedb2fdad71740adf07a7265b9be
RCTTypeSafety: 9ae0e9206625e995f0df4d5b9ddc94411929fb30
React: a71c8e1380f07e01de721ccd52bcf9c03e81867d
Expand Down Expand Up @@ -1141,4 +1141,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 4ed1c7b099741c82e2b0411b95f6468e72be6c76

COCOAPODS: 1.12.0
COCOAPODS: 1.12.1
3 changes: 1 addition & 2 deletions src/components/Checkbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const propTypes = {
forwardedRef: PropTypes.oneOfType([PropTypes.func, PropTypes.shape({current: PropTypes.instanceOf(React.Component)})]),

/** An accessibility label for the checkbox */
accessibilityLabel: PropTypes.string,
accessibilityLabel: PropTypes.string.isRequired,
};

const defaultProps = {
Expand All @@ -49,7 +49,6 @@ const defaultProps = {
forwardedRef: undefined,
children: null,
onMouseDown: undefined,
accessibilityLabel: '',
};

function Checkbox(props) {
Expand Down
5 changes: 5 additions & 0 deletions src/components/CheckboxWithLabel.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ const propTypes = {
/** Saves a draft of the input value when used in a form */
/* eslint-disable-next-line react/no-unused-prop-types */
shouldSaveDraft: PropTypes.bool,

/** An accessibility label for the checkbox */
accessibilityLabel: PropTypes.string,
};

const defaultProps = {
Expand All @@ -76,6 +79,7 @@ const defaultProps = {
value: false,
defaultValue: false,
forwardedRef: () => {},
accessibilityLabel: undefined,
};

function CheckboxWithLabel(props) {
Expand All @@ -100,6 +104,7 @@ function CheckboxWithLabel(props) {
label={props.label}
hasError={Boolean(props.errorText)}
forwardedRef={props.forwardedRef}
accessibilityLabel={props.accessibilityLabel || props.label}
/>
<PressableWithFeedback
focusable={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class CheckboxWithTooltipForMobileWebAndNative extends React.Component {
isChecked={this.props.isChecked}
onPress={this.showGrowlOrTriggerOnPress}
disabled={this.props.disabled}
accessibilityLabel={this.props.accessibilityLabel || this.props.text}
/>
</View>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ const propTypes = {
/** Wheter the checkbox is disabled */
disabled: PropTypes.bool,

/** An accessibility label for the checkbox */
accessibilityLabel: PropTypes.string,

/** Props inherited from withWindowDimensions */
...windowDimensionsPropTypes,
};
Expand All @@ -34,6 +37,7 @@ const defaultProps = {
disabled: false,
toggleTooltip: true,
growlType: CONST.GROWL.WARNING,
accessibilityLabel: undefined,
};

export {propTypes, defaultProps};
2 changes: 2 additions & 0 deletions src/components/CheckboxWithTooltip/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ function CheckboxWithTooltip(props) {
text={props.text}
toggleTooltip={props.toggleTooltip}
disabled={props.disabled}
accessibilityLabel={props.accessibilityLabel || props.text}
/>
);
}
Expand All @@ -24,6 +25,7 @@ function CheckboxWithTooltip(props) {
isChecked={props.isChecked}
onPress={props.onPress}
disabled={props.disabled}
accessibilityLabel={props.accessibilityLabel || props.text}
/>
);
return (
Expand Down
1 change: 1 addition & 0 deletions src/components/CheckboxWithTooltip/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ function CheckboxWithTooltip(props) {
onPress={props.onPress}
text={props.text}
toggleTooltip={props.toggleTooltip}
accessibilityLabel={props.accessibilityLabel || props.text}
/>
);
}
Expand Down
1 change: 1 addition & 0 deletions src/components/ReportActionItem/TaskPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function TaskPreview(props) {
TaskUtils.completeTask(props.taskReportID, taskTitle);
}
}}
accessibilityLabel={props.translate('newTaskPage.task')}
/>
<RenderHTML html={htmlForTaskPreview} />
</View>
Expand Down
4 changes: 3 additions & 1 deletion src/components/TextInput/BaseTextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import CONST from '../../CONST';
import FormHelpMessage from '../FormHelpMessage';
import isInputAutoFilled from '../../libs/isInputAutoFilled';
import * as Pressables from '../Pressable';
import withLocalize from '../withLocalize';

const PressableWithoutFeedback = Pressables.PressableWithoutFeedback;
class BaseTextInput extends Component {
Expand Down Expand Up @@ -346,6 +347,7 @@ class BaseTextInput extends Component {
style={[styles.flex1, styles.textInputIconContainer]}
onPress={this.togglePasswordVisibility}
onMouseDown={(e) => e.preventDefault()}
accessibilityLabel={this.props.translate('common.visible')}
>
<Icon
src={this.state.passwordHidden ? Expensicons.Eye : Expensicons.EyeDisabled}
Expand Down Expand Up @@ -399,4 +401,4 @@ class BaseTextInput extends Component {
BaseTextInput.propTypes = baseTextInputPropTypes.propTypes;
BaseTextInput.defaultProps = baseTextInputPropTypes.defaultProps;

export default BaseTextInput;
export default withLocalize(BaseTextInput);
1 change: 1 addition & 0 deletions src/languages/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export default {
details: 'Details',
privacy: 'Privacy',
hidden: 'Hidden',
visible: 'Visible',
delete: 'Delete',
archived: 'archived',
contacts: 'Contacts',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default {
details: 'Detalles',
privacy: 'Privacidad',
hidden: 'Oculto',
visible: 'Visible',
delete: 'Eliminar',
archived: 'archivado',
contacts: 'Contactos',
Expand Down
2 changes: 2 additions & 0 deletions src/pages/EnablePayments/TermsStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ function TermsStep(props) {
<ShortTermsForm />
<LongTermsForm />
<CheckboxWithLabel
accessibilityLabel={props.translate('termsStep.haveReadAndAgree')}
style={[styles.mb4, styles.mt4]}
onInputChange={toggleDisclosure}
LabelComponent={() => (
Expand All @@ -72,6 +73,7 @@ function TermsStep(props) {
)}
/>
<CheckboxWithLabel
accessibilityLabel={props.translate('termsStep.agreeToThe')}
onInputChange={togglePrivacyPolicy}
LabelComponent={() => (
<Text>
Expand Down
4 changes: 4 additions & 0 deletions src/pages/ReimbursementAccount/ACHContractStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ function ACHContractStep(props) {
<Text>{props.translate('beneficialOwnersStep.checkAllThatApply')}</Text>
</Text>
<CheckboxWithLabel
accessibilityLabel={props.translate('beneficialOwnersStep.iOwnMoreThan25Percent')}
inputID="ownsMoreThan25Percent"
style={[styles.mb2]}
LabelComponent={() => (
Expand All @@ -186,6 +187,7 @@ function ACHContractStep(props) {
shouldSaveDraft
/>
<CheckboxWithLabel
accessibilityLabel={props.translate('beneficialOwnersStep.someoneOwnsMoreThan25Percent')}
inputID="hasOtherBeneficialOwners"
style={[styles.mb2]}
LabelComponent={() => (
Expand Down Expand Up @@ -251,6 +253,7 @@ function ACHContractStep(props) {
)}
<Text style={[styles.mv5]}>{props.translate('beneficialOwnersStep.agreement')}</Text>
<CheckboxWithLabel
accessibilityLabel={`${props.translate('common.iAcceptThe')} ${props.translate('beneficialOwnersStep.termsAndConditions')}`}
inputID="acceptTermsAndConditions"
style={[styles.mt4]}
LabelComponent={() => (
Expand All @@ -263,6 +266,7 @@ function ACHContractStep(props) {
shouldSaveDraft
/>
<CheckboxWithLabel
accessibilityLabel={props.translate('beneficialOwnersStep.certifyTrueAndAccurate')}
inputID="certifyTrueInformation"
style={[styles.mt4]}
LabelComponent={() => <Text>{props.translate('beneficialOwnersStep.certifyTrueAndAccurate')}</Text>}
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/BankAccountManualStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ class BankAccountManualStep extends React.Component {
shouldUseDefaultValue={shouldDisableInputs}
/>
<CheckboxWithLabel
accessibilityLabel={`${this.props.translate('common.iAcceptThe')} ${this.props.translate('common.expensifyTermsOfService')}`}
style={styles.mt4}
inputID="acceptTerms"
LabelComponent={() => (
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/BankAccountPlaidStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ class BankAccountPlaidStep extends React.Component {
/>
{Boolean(selectedPlaidAccountID) && !_.isEmpty(lodashGet(this.props.plaidData, 'bankAccounts')) && (
<CheckboxWithLabel
accessibilityLabel={`${this.props.translate('common.iAcceptThe')} ${this.props.translate('common.expensifyTermsOfService')}`}
style={styles.mt4}
inputID="acceptTerms"
LabelComponent={() => (
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ class CompanyStep extends React.Component {
/>
</View>
<CheckboxWithLabel
accessibilityLabel={`${this.props.translate('companyStep.confirmCompanyIsNot')} ${this.props.translate('companyStep.listOfRestrictedBusinesses')}`}
inputID="hasNoConnectionToCannabis"
defaultValue={this.props.getDefaultStateForField('hasNoConnectionToCannabis', false)}
LabelComponent={() => (
Expand Down
1 change: 1 addition & 0 deletions src/pages/ReimbursementAccount/RequestorStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class RequestorStep extends React.Component {
shouldSaveDraft
/>
<CheckboxWithLabel
accessibilityLabel={this.props.translate('requestorStep.isControllingOfficer')}
inputID="isControllingOfficer"
defaultValue={this.props.getDefaultStateForField('isControllingOfficer', false)}
LabelComponent={() => (
Expand Down
1 change: 1 addition & 0 deletions src/pages/settings/Payments/AddDebitCardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ class DebitCardPage extends Component {
</View>
)}
<CheckboxWithLabel
accessibilityLabel={`${this.props.translate('common.iAcceptThe')} ${this.props.translate('common.expensifyTermsOfService')}`}
inputID="acceptTerms"
LabelComponent={() => (
<Text>
Expand Down
2 changes: 2 additions & 0 deletions src/pages/workspace/WorkspaceMembersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ function WorkspaceMembersPage(props) {
<Checkbox
isChecked={isChecked}
onPress={() => toggleUser(item.accountID, item.pendingAction)}
accessibilityLabel={item.displayName}
/>
<View style={styles.flex1}>
<OptionRow
Expand Down Expand Up @@ -451,6 +452,7 @@ function WorkspaceMembersPage(props) {
<Checkbox
isChecked={!_.isEmpty(removableMembers) && _.every(_.keys(removableMembers), (accountID) => _.contains(selectedEmployees, Number(accountID)))}
onPress={() => toggleAllUsers(removableMembers)}
accessibilityLabel={props.translate('workspace.people.selectAll')}
/>
<View style={[styles.flex1]}>
<Text style={[styles.textStrong, styles.ph5]}>{props.translate('workspace.people.selectAll')}</Text>
Expand Down

0 comments on commit a63eee4

Please sign in to comment.