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

Add missing accessibility labels #5390

Merged
merged 5 commits into from Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/AmountInput.js
Expand Up @@ -238,7 +238,7 @@
});

return (
<TouchableWithoutFeedback disabled={this.props.pointerEvents === 'none'} onPress={() => this.textInput.focus()}>
<TouchableWithoutFeedback accessibilityRole="button" accessibilityLabel={loc._.enter_amount} disabled={this.props.pointerEvents === 'none'} onPress={() => this.textInput.focus()}>

Check warning on line 241 in components/AmountInput.js

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.enter_amount}·disabled={this.props.pointerEvents·===·'none'}·onPress={()·=>·this.textInput.focus()}` with `⏎········accessibilityRole="button"⏎········accessibilityLabel={loc._.enter_amount}⏎········disabled={this.props.pointerEvents·===·'none'}⏎········onPress={()·=>·this.textInput.focus()}⏎······`
<>
<View style={styles.root}>
{!disabled && <View style={[styles.center, stylesHook.center]} />}
Expand Down Expand Up @@ -289,6 +289,7 @@
{!disabled && amount !== BitcoinUnit.MAX && (
<TouchableOpacity
accessibilityRole="button"
accessibilityLabel={loc._.change_input_currency}
testID="changeAmountUnitButton"
style={styles.changeAmountUnit}
onPress={this.changeAmountUnit}
Expand All @@ -306,6 +307,8 @@
</BlueText>
<View style={styles.spacing8} />
<TouchableOpacity
accessibilityRole="button"
accessibilityLabel={loc._.refresh}
onPress={this.updateRate}
disabled={this.state.isRateBeingUpdated}
style={this.state.isRateBeingUpdated ? styles.disabledButton : styles.enabledButon}
Expand Down
4 changes: 4 additions & 0 deletions components/ArrowPicker.tsx
Expand Up @@ -30,6 +30,8 @@ export const ArrowPicker = (props: ArrowPickerProps) => {
return (
<View style={{ flexDirection: 'row', alignItems: 'center' }}>
<Pressable
accessibilityRole="button"
accessibilityLabel={loc.send.dynamic_prev}
onPress={() => {
Keyboard.dismiss();
let newIndex = keyIndex;
Expand All @@ -56,6 +58,8 @@ export const ArrowPicker = (props: ArrowPickerProps) => {
<Text style={[styles.text, stylesHook.text]}>{props.isItemUnknown ? loc.send.fee_custom : keys[keyIndex]}</Text>
</View>
<Pressable
accessibilityRole="button"
accessibilityLabel={loc.send.dynamic_next}
onPress={() => {
Keyboard.dismiss();
let newIndex = keyIndex;
Expand Down
2 changes: 1 addition & 1 deletion components/Button.js
Expand Up @@ -38,7 +38,7 @@ const Button = props => {
const opacity = { opacity: disabled ? 0.5 : 1.0 };

return (
<TouchableOpacity onPress={onPress} disabled={disabled} style={opacity}>
<TouchableOpacity accessibilityRole="button" onPress={onPress} disabled={disabled} style={opacity}>
<View style={[styles.buttonContainer, buttonStyles()]}>
<Text style={[styles.text, textStyles()]}>{text}</Text>
</View>
Expand Down
2 changes: 1 addition & 1 deletion components/LdkButton.js
Expand Up @@ -7,7 +7,7 @@ import React from 'react';
export const LdkButton = props => {
const { colors } = useTheme();
return (
<TouchableOpacity onPress={props.onPress}>
<TouchableOpacity accessibilityRole="button" onPress={props.onPress}>
<View
style={{
borderColor: (props.active && colors.lnborderColor) || colors.buttonDisabledBackgroundColor,
Expand Down
2 changes: 1 addition & 1 deletion components/MultipleStepsListItem.js
Expand Up @@ -133,7 +133,7 @@ const MultipleStepsListItem = props => {
</>
)}
{!showActivityIndicator && props.rightButton && checked && (
<View style={styles.rightButtonContainer} accessibilityComponentType>
<View style={styles.rightButtonContainer}>
<TouchableOpacity
accessibilityRole="button"
disabled={props.rightButton.disabled}
Expand Down
4 changes: 2 additions & 2 deletions components/TooltipMenu.ios.js
Expand Up @@ -59,7 +59,7 @@
}}
style={buttonStyle}
>
{props.onPress ? <TouchableOpacity onPress={props.onPress}>{props.children}</TouchableOpacity> : props.children}
{props.onPress ? <TouchableOpacity accessibilityRole="button" onPress={props.onPress}>{props.children}</TouchableOpacity> : props.children}

Check warning on line 62 in components/TooltipMenu.ios.js

View workflow job for this annotation

GitHub Actions / test

Replace `<TouchableOpacity·accessibilityRole="button"·onPress={props.onPress}>{props.children}</TouchableOpacity>·:·props.children` with `(⏎········<TouchableOpacity·accessibilityRole="button"·onPress={props.onPress}>⏎··········{props.children}⏎········</TouchableOpacity>⏎······)·:·(⏎········props.children⏎······)`
</ContextMenuButton>
) : (
<ContextMenuView
Expand All @@ -81,8 +81,8 @@
}
: {})}
>
{props.onPress ? <TouchableOpacity onPress={props.onPress}>{props.children}</TouchableOpacity> : props.children}
{props.onPress ? <TouchableOpacity accessibilityRole="button" onPress={props.onPress}>{props.children}</TouchableOpacity> : props.children}
</ContextMenuView>

Check warning on line 85 in components/TooltipMenu.ios.js

View workflow job for this annotation

GitHub Actions / test

Replace `<TouchableOpacity·accessibilityRole="button"·onPress={props.onPress}>{props.children}</TouchableOpacity>·:·props.children` with `(⏎········<TouchableOpacity·accessibilityRole="button"·onPress={props.onPress}>⏎··········{props.children}⏎········</TouchableOpacity>⏎······)·:·(⏎········props.children⏎······)`
);
};

Expand Down
2 changes: 1 addition & 1 deletion components/TransactionsNavigationHeader.js
Expand Up @@ -260,7 +260,7 @@ export default class TransactionsNavigationHeader extends Component {
</TouchableOpacity>
)}
{this.state.wallet.type === LightningLdkWallet.type && (
<TouchableOpacity accessibilityRole="button" onPress={this.manageFundsPressed}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc.lnd.title} onPress={this.manageFundsPressed}>
<View style={styles.manageFundsButton}>
<Text style={styles.manageFundsButtonText}>{loc.lnd.title}</Text>
</View>
Expand Down
1 change: 1 addition & 0 deletions components/WalletsCarousel.js
Expand Up @@ -203,6 +203,7 @@ const WalletCarouselItem = ({ item, index, onPress, handleLongPress, isSelectedW
shadowRadius={8}
>
<TouchableWithoutFeedback
accessibilityRole="button"
testID={item.getLabel()}
onPressIn={onPressedIn}
onPressOut={onPressedOut}
Expand Down
8 changes: 4 additions & 4 deletions components/navigationStyle.tsx
Expand Up @@ -2,6 +2,7 @@
import React from 'react';
import { Image, Keyboard, TouchableOpacity, StyleSheet } from 'react-native';
import { Theme } from './themes';
import loc from '../loc';

const styles = StyleSheet.create({
button: {
Expand Down Expand Up @@ -56,7 +57,8 @@
navigation.goBack(null);
};
headerRight = () => (
<TouchableOpacity accessibilityRole="button" style={styles.button} onPress={handleClose} testID="NavigationCloseButton">
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.close} style={styles.button} onPress={handleClose} testID="NavigationCloseButton"

Check warning on line 60 in components/navigationStyle.tsx

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.close}·style={styles.button}·onPress={handleClose}` with `⏎············accessibilityRole="button"⏎············accessibilityLabel={loc._.close}⏎············style={styles.button}⏎············onPress={handleClose}⏎···········`
>
<Image source={theme.closeImage} />
</TouchableOpacity>
);
Expand Down Expand Up @@ -106,9 +108,7 @@
headerBackTitleVisible: false,
headerTintColor: theme.colors.foregroundColor,
headerLeft: () => (
<TouchableOpacity
accessibilityRole="button"
style={styles.button}
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.close} style={styles.button}

Check warning on line 111 in components/navigationStyle.tsx

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.close}` with `⏎············accessibilityRole="button"⏎············accessibilityLabel={loc._.close}⏎···········`
onPress={() => {
Keyboard.dismiss();
navigation.goBack(null);
Expand Down
10 changes: 9 additions & 1 deletion loc/en.json
Expand Up @@ -18,7 +18,15 @@
"wallet_key": "Wallet key",
"invalid_animated_qr_code_fragment": "Invalid animated QRCode fragment. Please try again.",
"file_saved": "File {filePath} has been saved in your {destination}.",
"downloads_folder": "Downloads Folder"
"downloads_folder": "Downloads Folder",
"close": "Close",
"change_input_currency": "Change input currency",
"refresh": "Refresh",
"more": "More",
"pick_image": "Choose image from library",
"pick_file": "Choose a file",
"enter_amount": "Enter amount",
"qr_custom_input_button": "Tap 10 times to enter custom input"
},
"alert": {
"default": "Alert"
Expand Down
2 changes: 1 addition & 1 deletion screen/lnd/ldkInfo.tsx
Expand Up @@ -296,7 +296,7 @@ const LdkInfo = () => {
const channelData = channel.channel.item;

return (
<TouchableOpacity onPress={() => showModal(channel)}>
<TouchableOpacity accessibilityRole="button" onPress={() => showModal(channel)}>
<LNNodeBar
disabled={!channelData.is_usable}
canSend={Number(channelData.outbound_capacity_msat / 1000)}
Expand Down
8 changes: 5 additions & 3 deletions screen/send/ScanQRCode.js
Expand Up @@ -344,14 +344,14 @@
<BlueButton title={loc.send.open_settings} onPress={openPrivacyDesktopSettings} />
</View>
)}
<TouchableOpacity style={styles.closeTouch} onPress={dismiss}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.close} style={styles.closeTouch} onPress={dismiss}>
<Image style={styles.closeImage} source={require('../../img/close-white.png')} />
</TouchableOpacity>
<TouchableOpacity style={styles.imagePickerTouch} onPress={showImagePicker}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.pick_image} style={styles.imagePickerTouch} onPress={showImagePicker}>

Check warning on line 350 in screen/send/ScanQRCode.js

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.pick_image}·style={styles.imagePickerTouch}·onPress={showImagePicker}` with `⏎········accessibilityRole="button"⏎········accessibilityLabel={loc._.pick_image}⏎········style={styles.imagePickerTouch}⏎········onPress={showImagePicker}⏎······`
<Icon name="image" type="font-awesome" color="#ffffff" />
</TouchableOpacity>
{showFileImportButton && (
<TouchableOpacity style={styles.filePickerTouch} onPress={showFilePicker}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.pick_file} style={styles.filePickerTouch} onPress={showFilePicker}>

Check warning on line 354 in screen/send/ScanQRCode.js

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.pick_file}·style={styles.filePickerTouch}·onPress={showFilePicker}` with `⏎··········accessibilityRole="button"⏎··········accessibilityLabel={loc._.pick_file}⏎··········style={styles.filePickerTouch}⏎··········onPress={showFilePicker}⏎········`
<Icon name="file-import" type="font-awesome-5" color="#ffffff" />
</TouchableOpacity>
)}
Expand Down Expand Up @@ -392,6 +392,8 @@
</View>
)}
<TouchableOpacity
accessibilityRole="button"
accessibilityLabel={loc._.qr_custom_input_button}
testID="ScanQrBackdoorButton"
style={styles.backdoorButton}
onPress={async () => {
Expand Down
2 changes: 1 addition & 1 deletion screen/send/details.js
Expand Up @@ -1388,7 +1388,7 @@ const SendDetails = () => {
/>

{frozenBalance > 0 && (
<TouchableOpacity style={styles.frozenContainer} onPress={handleCoinControl}>
<TouchableOpacity accessibilityRole="button" style={styles.frozenContainer} onPress={handleCoinControl}>
<BlueText>
{loc.formatString(loc.send.details_frozen, { amount: formatBalanceWithoutSuffix(frozenBalance, BitcoinUnit.BTC, true) })}
</BlueText>
Expand Down
2 changes: 1 addition & 1 deletion screen/settings/SettingsPrivacy.js
Expand Up @@ -103,7 +103,7 @@ const SettingsPrivacy = () => {

return (
<ScrollView style={[styles.root, stylesWithThemeHook.root]}>
<Pressable onPress={onDisablePrivacyTapped}>
<Pressable accessibilityRole="button" onPress={onDisablePrivacyTapped}>
<BlueHeaderDefaultSub leftText={loc.settings.general} rightComponent={null} />
</Pressable>
<BlueListItem
Expand Down
2 changes: 1 addition & 1 deletion screen/wallets/import.js
Expand Up @@ -145,7 +145,7 @@ const WalletsImport = () => {
return (
<SafeBlueArea style={styles.root}>
<BlueSpacing20 />
<TouchableWithoutFeedback onPress={speedBackdoorTap} testID="SpeedBackdoor">
<TouchableWithoutFeedback accessibilityRole="button" onPress={speedBackdoorTap} testID="SpeedBackdoor">
<BlueFormLabel>{loc.wallets.import_explanation}</BlueFormLabel>
</TouchableWithoutFeedback>
<BlueSpacing20 />
Expand Down
8 changes: 4 additions & 4 deletions screen/wallets/ldkViewLogs.js
Expand Up @@ -39,7 +39,7 @@
.finally(() => {
setOptions({
headerRight: () => (
<TouchableOpacity style={styles.reloadLogs} onPress={getLogs}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc.wallets.list_tryagain} style={styles.reloadLogs} onPress={getLogs}>

Check warning on line 42 in screen/wallets/ldkViewLogs.js

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc.wallets.list_tryagain}·style={styles.reloadLogs}·onPress={getLogs}` with `⏎··············accessibilityRole="button"⏎··············accessibilityLabel={loc.wallets.list_tryagain}⏎··············style={styles.reloadLogs}⏎··············onPress={getLogs}⏎············`
<Icon name="redo" type="font-awesome-5" size={22} color={colors.foregroundColor} />
</TouchableOpacity>
),
Expand Down Expand Up @@ -104,13 +104,13 @@
return (
<SafeBlueArea>
<ScrollView style={styles.root}>
<TouchableOpacity onPress={selfTest} style={styles.button}>
<TouchableOpacity accessibilityRole="button" onPress={selfTest} style={styles.button}>
<BlueText>self test</BlueText>
</TouchableOpacity>
<TouchableOpacity onPress={exportLogs} style={styles.button}>
<TouchableOpacity accessibilityRole="button" onPress={exportLogs} style={styles.button}>
<BlueText>export logs to a file</BlueText>
</TouchableOpacity>
<TouchableOpacity onPress={syncBlockchain} style={styles.button}>
<TouchableOpacity accessibilityRole="button" onPress={syncBlockchain} style={styles.button}>
<BlueText>sync blockchain</BlueText>
</TouchableOpacity>
<BlueText>Identity pubkey: {getInfo.identityPubkey}</BlueText>
Expand Down
6 changes: 3 additions & 3 deletions screen/wallets/list.js
Expand Up @@ -103,13 +103,13 @@
},
headerRight: () =>
I18nManager.isRTL ? null : (
<TouchableOpacity accessibilityRole="button" testID="SettingsButton" style={styles.headerTouch} onPress={navigateToSettings}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.more} testID="SettingsButton" style={styles.headerTouch} onPress={navigateToSettings}>

Check warning on line 106 in screen/wallets/list.js

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.more}·testID="SettingsButton"·style={styles.headerTouch}·onPress={navigateToSettings}` with `⏎············accessibilityRole="button"⏎············accessibilityLabel={loc._.more}⏎············testID="SettingsButton"⏎············style={styles.headerTouch}⏎············onPress={navigateToSettings}⏎··········`
<Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} />
</TouchableOpacity>
),
headerLeft: () =>
I18nManager.isRTL ? (
<TouchableOpacity accessibilityRole="button" testID="SettingsButton" style={styles.headerTouch} onPress={navigateToSettings}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.more} testID="SettingsButton" style={styles.headerTouch} onPress={navigateToSettings}>

Check warning on line 112 in screen/wallets/list.js

View workflow job for this annotation

GitHub Actions / test

Replace `·accessibilityRole="button"·accessibilityLabel={loc._.more}·testID="SettingsButton"·style={styles.headerTouch}·onPress={navigateToSettings}` with `⏎············accessibilityRole="button"⏎············accessibilityLabel={loc._.more}⏎············testID="SettingsButton"⏎············style={styles.headerTouch}⏎············onPress={navigateToSettings}⏎··········`
<Icon size={22} name="more-horiz" type="material" color={colors.foregroundColor} />
</TouchableOpacity>
) : null,
Expand Down Expand Up @@ -177,7 +177,7 @@
{`${loc.transactions.list_title}${' '}`}
</Text>
{isDesktop && (
<TouchableOpacity accessibilityRole="button" style={style} onPress={() => refreshTransactions(true)} disabled={isLoading}>
<TouchableOpacity accessibilityRole="button" accessibilityLabel={loc._.refresh} style={style} onPress={() => refreshTransactions(true)} disabled={isLoading}>
<Icon name="refresh" type="font-awesome" color={colors.feeText} />
</TouchableOpacity>
)}
Expand Down
1 change: 1 addition & 0 deletions screen/wallets/reorderWallets.js
Expand Up @@ -103,6 +103,7 @@ const ReorderWallets = () => {
return (
<ScaleDecorator>
<Pressable
accessibilityRole="button"
disabled={isActive}
onLongPress={drag}
onPress={() => navigateToWallet(item)}
Expand Down