Don't underline links on native hover (#6588)

This commit is contained in:
dan
2024-11-21 19:20:46 +00:00
committed by GitHub
parent dff11fc076
commit ff23ddb556
2 changed files with 13 additions and 23 deletions
+7 -11
View File
@@ -274,11 +274,6 @@ export function InlineLinkText({
onOut: onHoverOut, onOut: onHoverOut,
} = useInteractionState() } = useInteractionState()
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState() const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
const {
state: pressed,
onIn: onPressIn,
onOut: onPressOut,
} = useInteractionState()
const flattenedStyle = flatten(style) || {} const flattenedStyle = flatten(style) || {}
return ( return (
@@ -289,19 +284,20 @@ export function InlineLinkText({
{...rest} {...rest}
style={[ style={[
{color: t.palette.primary_500}, {color: t.palette.primary_500},
(hovered || focused || pressed) && (hovered || focused) &&
!disableUnderline && { !disableUnderline && {
...web({outline: 0}), ...web({
textDecorationLine: 'underline', outline: 0,
textDecorationColor: flattenedStyle.color ?? t.palette.primary_500, textDecorationLine: 'underline',
textDecorationColor:
flattenedStyle.color ?? t.palette.primary_500,
}),
}, },
flattenedStyle, flattenedStyle,
]} ]}
role="link" role="link"
onPress={download ? undefined : onPress} onPress={download ? undefined : onPress}
onLongPress={onLongPress} onLongPress={onLongPress}
onPressIn={onPressIn}
onPressOut={onPressOut}
onFocus={onFocus} onFocus={onFocus}
onBlur={onBlur} onBlur={onBlur}
onMouseEnter={onHoverIn} onMouseEnter={onHoverIn}
+6 -12
View File
@@ -53,7 +53,6 @@ export function RichText({
const plainStyles = [a.leading_snug, flattenedStyle] const plainStyles = [a.leading_snug, flattenedStyle]
const interactiveStyles = [ const interactiveStyles = [
a.leading_snug, a.leading_snug,
a.pointer_events_auto,
flatten(interactiveStyle), flatten(interactiveStyle),
flattenedStyle, flattenedStyle,
] ]
@@ -194,11 +193,6 @@ function RichTextTag({
onOut: onHoverOut, onOut: onHoverOut,
} = useInteractionState() } = useInteractionState()
const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState() const {state: focused, onIn: onFocus, onOut: onBlur} = useInteractionState()
const {
state: pressed,
onIn: onPressIn,
onOut: onPressOut,
} = useInteractionState()
const navigation = useNavigation<NavigationProp>() const navigation = useNavigation<NavigationProp>()
const navigateToPage = React.useCallback(() => { const navigateToPage = React.useCallback(() => {
@@ -228,8 +222,6 @@ function RichTextTag({
accessibilityRole: isNative ? 'button' : undefined, accessibilityRole: isNative ? 'button' : undefined,
onPress: navigateToPage, onPress: navigateToPage,
onLongPress: openDialog, onLongPress: openDialog,
onPressIn: onPressIn,
onPressOut: onPressOut,
})} })}
{...web({ {...web({
onMouseEnter: onHoverIn, onMouseEnter: onHoverIn,
@@ -243,10 +235,12 @@ function RichTextTag({
cursor: 'pointer', cursor: 'pointer',
}), }),
{color: t.palette.primary_500}, {color: t.palette.primary_500},
(hovered || focused || pressed) && { (hovered || focused) && {
...web({outline: 0}), ...web({
textDecorationLine: 'underline', outline: 0,
textDecorationColor: t.palette.primary_500, textDecorationLine: 'underline',
textDecorationColor: t.palette.primary_500,
}),
}, },
style, style,
]}> ]}>