Checkboxes with the same name must behave like a radio buttons group

* aims to fix issue #12706
This commit is contained in:
Calixte Denizet 2020-12-08 15:50:16 +01:00
parent b194c820bf
commit 1fcffe8034

View File

@ -717,6 +717,16 @@ class CheckboxWidgetAnnotationElement extends WidgetAnnotationElement {
}
element.addEventListener("change", function (event) {
const name = event.target.name;
for (const checkbox of document.getElementsByName(name)) {
if (checkbox !== event.target) {
checkbox.checked = false;
storage.setValue(
checkbox.parentNode.getAttribute("data-annotation-id"),
{ value: false }
);
}
}
storage.setValue(id, { value: event.target.checked });
});