Skip to content
Merged
Changes from all 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 @@ -37,6 +37,7 @@ function GenericPressable({
interactive = true,
isNested = false,
ref,
dataSet,
...rest
}: PressableProps) {
const styles = useThemeStyles();
Expand All @@ -45,6 +46,7 @@ function GenericPressable({
const isScreenReaderActive = Accessibility.useScreenReaderStatus();
const [hitSlop, onLayout] = Accessibility.useAutoHitSlop();
const [isHovered, setIsHovered] = useState(false);
const isRoleButton = [rest.accessibilityRole, rest.role].includes(CONST.ROLE.BUTTON);

const isDisabled = useMemo(() => {
let shouldBeDisabledByScreenReader = false;
Expand Down Expand Up @@ -152,6 +154,7 @@ function GenericPressable({
onKeyDown={!isDisabled ? onKeyDown : undefined}
onPressIn={!isDisabled ? onPressIn : undefined}
onPressOut={!isDisabled ? onPressOut : undefined}
dataSet={{...(isRoleButton ? {[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true} : {}), ...(dataSet ?? {})}}
style={(state) => [
cursorStyle,
StyleUtils.parseStyleFromFunction(style, state),
Expand All @@ -160,6 +163,7 @@ function GenericPressable({
(state.hovered || isHovered) && StyleUtils.parseStyleFromFunction(hoverStyle, state),
state.pressed && StyleUtils.parseStyleFromFunction(pressStyle, state),
isDisabled && [StyleUtils.parseStyleFromFunction(disabledStyle, state), styles.noSelect],
isRoleButton && styles.userSelectNone,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

On web, react-native-web maps accessibilityRole="button" to a native element.

Safari does not allow normal drag-to-select text behavior within the native button element. this change lead to includes -webkit-user-select: none but safari doesn't allow selecting the text within the button element, it leads to this issue:
#89301

]}
// accessibility props
accessibilityState={{
Expand Down
Loading