mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-04-01 18:06:46 +00:00
Merge pull request #2061 from lightpanda-io/ariaAtomic
Add Element.ariaAtomic and Element.ariaLive properties
This commit is contained in:
@@ -523,6 +523,31 @@ pub fn setDir(self: *Element, value: []const u8, page: *Page) !void {
|
||||
return self.setAttributeSafe(comptime .wrap("dir"), .wrap(value), page);
|
||||
}
|
||||
|
||||
// ARIAMixin - ARIA attribute reflection
|
||||
pub fn getAriaAtomic(self: *const Element) ?[]const u8 {
|
||||
return self.getAttributeSafe(comptime .wrap("aria-atomic"));
|
||||
}
|
||||
|
||||
pub fn setAriaAtomic(self: *Element, value: ?[]const u8, page: *Page) !void {
|
||||
if (value) |v| {
|
||||
try self.setAttributeSafe(comptime .wrap("aria-atomic"), .wrap(v), page);
|
||||
} else {
|
||||
try self.removeAttribute(comptime .wrap("aria-atomic"), page);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getAriaLive(self: *const Element) ?[]const u8 {
|
||||
return self.getAttributeSafe(comptime .wrap("aria-live"));
|
||||
}
|
||||
|
||||
pub fn setAriaLive(self: *Element, value: ?[]const u8, page: *Page) !void {
|
||||
if (value) |v| {
|
||||
try self.setAttributeSafe(comptime .wrap("aria-live"), .wrap(v), page);
|
||||
} else {
|
||||
try self.removeAttribute(comptime .wrap("aria-live"), page);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn getClassName(self: *const Element) []const u8 {
|
||||
return self.getAttributeSafe(comptime .wrap("class")) orelse "";
|
||||
}
|
||||
@@ -1686,6 +1711,8 @@ pub const JsApi = struct {
|
||||
pub const localName = bridge.accessor(Element.getLocalName, null, .{});
|
||||
pub const id = bridge.accessor(Element.getId, Element.setId, .{});
|
||||
pub const slot = bridge.accessor(Element.getSlot, Element.setSlot, .{});
|
||||
pub const ariaAtomic = bridge.accessor(Element.getAriaAtomic, Element.setAriaAtomic, .{});
|
||||
pub const ariaLive = bridge.accessor(Element.getAriaLive, Element.setAriaLive, .{});
|
||||
pub const dir = bridge.accessor(Element.getDir, Element.setDir, .{});
|
||||
pub const className = bridge.accessor(Element.getClassName, Element.setClassName, .{});
|
||||
pub const classList = bridge.accessor(Element.getClassList, Element.setClassList, .{});
|
||||
|
||||
Reference in New Issue
Block a user