Skip to content

Commit 3ab8575

Browse files
committed
fix: preserve in-page anchor scrolling in markdown viewer
Move preventDefault() after the hash-link check so that #anchor links retain their default scrolling behavior.
1 parent d40a95f commit 3ab8575

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ui/components/ServersView/MarkdownContent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ const MarkdownContent = ({
6565
const rawHref = anchor.getAttribute('href');
6666
if (!rawHref) return;
6767

68-
e.preventDefault();
69-
70-
// Skip in-page anchor links
68+
// Allow in-page anchor links to scroll normally
7169
if (rawHref.startsWith('#')) return;
7270

71+
e.preventDefault();
72+
7373
try {
7474
const resolved = new URL(rawHref, url);
7575
const allowedProtocols = ['http:', 'https:', 'mailto:'];

0 commit comments

Comments
 (0)