Skip to content

Commit 8fa13b5

Browse files
committed
Fix empty links interpreted as not empty, resulted in weird behavior
Some links like this caused problems: <a href="" /> This was because a.href returned "(page)/index.html", while I'd expected that to return "". To fix this, I just switched to using a.getAttribute('href').
1 parent d4aa4fd commit 8fa13b5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

web/src/components/IFrame.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ export default function IFrame(props: Props): JSX.Element {
3737
return
3838
}
3939

40-
if (a.href.trim() === '') {
41-
// ignore empty links, may be handled with js internally,
42-
// so we'll ignore it. Will inevitably cause the user to have to click back
40+
const href = a.getAttribute('href') ?? ''
41+
if (href.trim() === '') {
42+
// ignore empty links, may be handled with js internally.
43+
// Will inevitably cause the user to have to click back
4344
// multiple times to get back to the previous page.
4445
return
4546
}

0 commit comments

Comments
 (0)