fix(app): preventDefault in capture phase for MarkdownLink anchor
Pressable's click handler calls stopPropagation, so the bubble-phase preventDefault on the wrapping <a> never fired and the Electron view navigated to the href in addition to the existing helper opening it in the OS browser. Move preventDefault to onClickCapture (and onAuxClickCapture for middle-click) so it always runs first. The existing Pressable.onPress helper remains the only path that actually opens links.
This commit is contained in:
@@ -908,7 +908,12 @@ function MarkdownLink({
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a href={href} onClick={preventAnchorNavigation} style={MARKDOWN_LINK_ANCHOR_STYLE}>
|
<a
|
||||||
|
href={href}
|
||||||
|
onClickCapture={preventAnchorNavigation}
|
||||||
|
onAuxClickCapture={preventAnchorNavigation}
|
||||||
|
style={MARKDOWN_LINK_ANCHOR_STYLE}
|
||||||
|
>
|
||||||
<Pressable
|
<Pressable
|
||||||
accessibilityRole="link"
|
accessibilityRole="link"
|
||||||
onPress={handlePress}
|
onPress={handlePress}
|
||||||
|
|||||||
Reference in New Issue
Block a user