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

Fix wrong cursor style based on accessibility role #31605

Merged
merged 3 commits into from
Jan 22, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function GenericPressable(
onPressIn={!isDisabled ? onPressIn : undefined}
onPressOut={!isDisabled ? onPressOut : undefined}
style={(state) => [
getCursorStyle(shouldUseDisabledCursor, [rest.accessibilityRole, rest.role].includes('text')),
getCursorStyle(shouldUseDisabledCursor, [rest.accessibilityRole, rest.role].includes('presentation')),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
getCursorStyle(shouldUseDisabledCursor, [rest.accessibilityRole, rest.role].includes('presentation')),
getCursorStyle(shouldUseDisabledCursor, [rest.accessibilityRole, rest.role].includes(CONST.ACCESSIBILITY_ROLE.TEXT)),

StyleUtils.parseStyleFromFunction(style, state),
isScreenReaderActive && StyleUtils.parseStyleFromFunction(screenReaderActiveStyle, state),
state.focused && StyleUtils.parseStyleFromFunction(focusStyle, state),
Expand Down
4 changes: 2 additions & 2 deletions src/components/Pressable/GenericPressable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {ForwardedRef, forwardRef} from 'react';
import {Role, View} from 'react-native';
import {View} from 'react-native';
import GenericPressable from './BaseGenericPressable';
import PressableProps from './types';

Expand All @@ -14,7 +14,7 @@ function WebGenericPressable({focusable = true, ...props}: PressableProps, ref:
// change native accessibility props to web accessibility props
focusable={focusable}
tabIndex={!accessible || !focusable ? -1 : 0}
role={props.accessibilityRole as Role}
role={props.role}
id={props.nativeID}
aria-label={props.accessibilityLabel}
aria-labelledby={props.accessibilityLabelledBy}
Expand Down
Loading