Skip to content

Commit

Permalink
Checkboxes with the same name must behave like a radio buttons group
Browse files Browse the repository at this point in the history
 * aims to fix issue #12706
  • Loading branch information
calixteman committed Dec 8, 2020
1 parent b194c82 commit 1fcffe8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
});

Expand Down

0 comments on commit 1fcffe8

Please sign in to comment.