Merge pull request #865 from Demonthos/fix-anchor-link-for-block-level-elements

Fix anchor link for block-level elements
This commit is contained in:
Jon Kelley authored and GitHub committed 2023-03-06 21:05:59 -08:00
commit 6a16df835d
1 file changed
+5 -4
+5 -4
View File
@@ -357,10 +357,11 @@ class Interpreter {
if (event.type === "click") {
// 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");
let a_element = target.closest("a");
if (a_element != null) {
event.preventDefault();
if (shouldPreventDefault !== `onclick` && a_element.getAttribute(`dioxus-prevent-default`) !== `onclick`) {
const href = a_element.getAttribute("href");
if (href !== "" && href !== null && href !== undefined) {
window.ipc.postMessage(
serializeIpcMessage("browser_open", { href })