mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-15 15:58:57 +00:00
change the focus on click event
This commit is contained in:
@@ -934,6 +934,7 @@ pub const Page = struct {
|
|||||||
const element: *parser.Element = @ptrCast(node);
|
const element: *parser.Element = @ptrCast(node);
|
||||||
const href = (try parser.elementGetAttribute(element, "href")) orelse return;
|
const href = (try parser.elementGetAttribute(element, "href")) orelse return;
|
||||||
try self.navigateFromWebAPI(href, .{}, .{ .push = null });
|
try self.navigateFromWebAPI(href, .{}, .{ .push = null });
|
||||||
|
return;
|
||||||
},
|
},
|
||||||
.input => {
|
.input => {
|
||||||
const element: *parser.Element = @ptrCast(node);
|
const element: *parser.Element = @ptrCast(node);
|
||||||
@@ -956,6 +957,12 @@ pub const Page = struct {
|
|||||||
},
|
},
|
||||||
else => {},
|
else => {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set the focus on the clicked element.
|
||||||
|
// Thanks to parser.nodeHTMLGetTagType, we know nod is an element.
|
||||||
|
// We assume we have a ElementHTML.
|
||||||
|
const Document = @import("dom/document.zig").Document;
|
||||||
|
try Document.setFocus(@ptrCast(self.window.document), @as(*parser.ElementHTML, @ptrCast(node)), self);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const KeyboardEvent = struct {
|
pub const KeyboardEvent = struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user