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:
Mohamed Boudra
2026-05-09 12:44:07 +07:00
parent 650d3148e9
commit 0364e8dc5e

View File

@@ -908,7 +908,12 @@ function MarkdownLink({
}
return (
<a href={href} onClick={preventAnchorNavigation} style={MARKDOWN_LINK_ANCHOR_STYLE}>
<a
href={href}
onClickCapture={preventAnchorNavigation}
onAuxClickCapture={preventAnchorNavigation}
style={MARKDOWN_LINK_ANCHOR_STYLE}
>
<Pressable
accessibilityRole="link"
onPress={handlePress}