Merge pull request #220 from DioxusLabs/jk/outerlinking

fix: always prevent default on `A` tags in desktop
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2022-02-08 15:10:36 -05:00
commit 82b0e6c8d6
1 file changed
+6
+6
View File
@@ -204,12 +204,18 @@ export class Interpreter {
// todo call prevent default if it's the right type of event
if (shouldPreventDefault !== `onclick`) {
if (target.tagName == "A") {
event.preventDefault();
const href = target.getAttribute("href");
if (href !== "" && href !== null && href !== undefined) {
window.rpc.call("browser_open", { href });
}
}
}
// also prevent buttons from submitting
if (target.tagName == "BUTTON") {
event.preventDefault();
}
}
// walk the tree to find the real element
while (realId == null) {