Skip to content

Commit 53c3364

Browse files
feat(a11y): support message keyboard long press (#7206)
* feat: message a11y long press * chore: snapshot test * fix: e2e tests
1 parent 7643f53 commit 53c3364

7 files changed

Lines changed: 111556 additions & 104866 deletions

File tree

.maestro/helpers/login.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ onFlowStart:
2020
- inputText: ${USERNAME || output.createdUser.email}
2121
- tapOn:
2222
text: '.*Username or email.*'
23+
- pressKey: enter
2324
- tapOn:
2425
id: login-view-password
2526
- inputText: ${PASSWORD || output.createdUser.password}

app/containers/message/Touch.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
TouchableHighlight,
1111
type TouchableWithoutFeedbackProps
1212
} from 'react-native';
13+
import { withKeyboardFocus } from 'react-native-external-keyboard';
1314

1415
import { useTheme } from '../../theme';
1516
import { isIOS } from '../../lib/methods/helpers';
@@ -28,6 +29,7 @@ export interface ITouchProps extends TouchableWithoutFeedbackProps {
2829
}
2930

3031
const Component = isIOS ? TouchableOpacity : TouchableHighlight;
32+
const KeyboardComponent = withKeyboardFocus(Component);
3133

3234
const Touch = React.forwardRef<View, ITouchProps>(
3335
(
@@ -81,13 +83,15 @@ const Touch = React.forwardRef<View, ITouchProps>(
8183
const touchableProps = isIOS ? {} : { underlayColor: android_rippleColor ?? colors.surfaceNeutral, activeOpacity: 1 };
8284

8385
return (
84-
<Component
86+
<KeyboardComponent
8587
ref={ref}
8688
onPress={onPress}
8789
style={[rectButtonStyle, marginStyles, { backgroundColor, borderRadius }]}
88-
disabled={!enabled}
8990
{...touchableProps}
90-
{...props}>
91+
{...props}
92+
disabled={!enabled}
93+
focusable={enabled}
94+
canBeFocused={enabled}>
9195
<View
9296
accessible={accessible}
9397
accessibilityRole={props.accessibilityRole}
@@ -98,7 +102,7 @@ const Touch = React.forwardRef<View, ITouchProps>(
98102
style={viewStyle}>
99103
{children}
100104
</View>
101-
</Component>
105+
</KeyboardComponent>
102106
);
103107
}
104108
);

0 commit comments

Comments
 (0)