shithub: mycel

Download patch

ref: 11f03608f13d41ab976282e81f56b65b783d856f
parent: b0f057869b6c4fe492224a134c83403469e24f14
author: Philip Silva <philip.silva@protonmail.com>
date: Sat Jan 23 09:04:20 EST 2021

Forward Element click consumed

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -464,8 +464,8 @@
 
 func (el *Element) click() (consumed bool) {
 	if el.Click != nil {
-		el.Click()
-		return
+		e := el.Click()
+		return e.Consumed
 	}
 
 	if !*ExperimentalJsInsecure {
--- a/browser/browser_test.go
+++ b/browser/browser_test.go
@@ -29,6 +29,19 @@
 	expect string
 }
 
+func TestElementClick(t *testing.T) {
+	el := Element{}
+	for _, b := range []bool{true, false} {
+		el.Click = func() (e duit.Event) {
+			e.Consumed = b
+			return
+		}
+		if el.click() != b {
+			t.Fail()
+		}
+	}
+}
+
 func TestArrange(t *testing.T) {
 	htm := `
 		<div>