shithub: mycel

Download patch

ref: 1599c124b605bd91542dba27c2deedc163e516a4
parent: 4de121d2ae73148170b35ff881c4aa97d77cd5dd
author: Philip Silva <philip.silva@protonmail.com>
date: Wed Dec 16 15:14:45 EST 2020

Return to submit form

--- a/browser/browser.go
+++ b/browser/browser.go
@@ -296,13 +296,11 @@
 		Font: n.Font(),
 		Click: func() (r duit.Event) {
 			b.submit(n.ParentForm().DomSubtree)
-			//r.Consumed = true
 			return duit.Event{
 				Consumed:   true,
 				NeedLayout: true,
 				NeedDraw:   true,
 			}
-			//return
 		},
 	}
 	return &Element{
@@ -320,9 +318,20 @@
 				Placeholder: attr(*n.DomSubtree, "placeholder"),
 				Password:    t == "password",
 				Text:        attr(*n.DomSubtree, "value"),
-				Changed: func(t string) (r duit.Event) {
+				Changed: func(t string) (e duit.Event) {
 					setAttr(n.DomSubtree, "value", t)
-					r.Consumed = true
+					e.Consumed = true
+					return
+				},
+				Keys: func(k rune, m draw.Mouse) (e duit.Event) {
+					if k == 10 {
+						browser.submit(n.ParentForm().DomSubtree)
+						return duit.Event{
+							Consumed:   true,
+							NeedLayout: true,
+							NeedDraw:   true,
+						}
+					}
 					return
 				},
 			}),