fix yes/no radio input (#955)
This commit is contained in:
@@ -850,6 +850,16 @@ function buildElementObject(frame, element, interactable, purgeable = false) {
|
|||||||
attrs["required"] = true;
|
attrs["required"] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
elementTagNameLower === "input" &&
|
||||||
|
(element.type === "radio" || element.type === "checkbox")
|
||||||
|
) {
|
||||||
|
// if checkbox and radio don't have "checked" and "aria-checked", add a checked="false" to help LLM understand
|
||||||
|
if (!("checked" in attrs) && !("aria-checked" in attrs)) {
|
||||||
|
attrs["checked"] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (elementTagNameLower === "input" || elementTagNameLower === "textarea") {
|
if (elementTagNameLower === "input" || elementTagNameLower === "textarea") {
|
||||||
attrs["value"] = element.value;
|
attrs["value"] = element.value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -573,7 +573,7 @@ def _trimmed_attributes(attributes: dict) -> dict:
|
|||||||
for key in attributes:
|
for key in attributes:
|
||||||
if key == "role" and attributes[key] in ["listbox", "option"]:
|
if key == "role" and attributes[key] in ["listbox", "option"]:
|
||||||
new_attributes[key] = attributes[key]
|
new_attributes[key] = attributes[key]
|
||||||
if key in RESERVED_ATTRIBUTES and attributes[key]:
|
if key in RESERVED_ATTRIBUTES:
|
||||||
new_attributes[key] = attributes[key]
|
new_attributes[key] = attributes[key]
|
||||||
|
|
||||||
return new_attributes
|
return new_attributes
|
||||||
|
|||||||
Reference in New Issue
Block a user