Unverified Commit a14d0137 authored by Jude Gao's avatar Jude Gao Committed by GitHub

doc: onNavigate follow-up (#77805)

Fix the logic when user explicitly wants to leave the page but
navigation is blocked.
parent 95b2c193
......@@ -1362,11 +1362,11 @@ export function CustomLink({ children, ...props }: CustomLinkProps) {
return (
<Link
onNavigate={(e) => {
if (isBlocked) {
if (
isBlocked &&
!window.confirm('You have unsaved changes. Leave anyway?')
) {
e.preventDefault()
if (!window.confirm('You have unsaved changes. Leave anyway?')) {
e.preventDefault()
}
}
}}
{...props}
......@@ -1389,11 +1389,11 @@ export function CustomLink({ children, ...props }) {
return (
<Link
onNavigate={(e) => {
if (isBlocked) {
if (
isBlocked &&
!window.confirm('You have unsaved changes. Leave anyway?')
) {
e.preventDefault()
if (!window.confirm('You have unsaved changes. Leave anyway?')) {
e.preventDefault()
}
}
}}
{...props}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment