Don't interact with fields that are already filled in (#183)

This commit is contained in:
Kerem Yilmaz
2024-04-12 20:05:25 -07:00
committed by GitHub
parent 3ea46b93cf
commit 7b1c1d5a02
4 changed files with 13 additions and 5 deletions

View File

@@ -505,6 +505,9 @@ function buildTreeFromBody() {
const selectContainers = document.querySelectorAll(".select2-container");
selectContainers.forEach((element) => {
// hide the select2 container
element.style.display = "none";
// search select in previous
let _pre = element.previousElementSibling;
while (_pre) {
@@ -513,8 +516,6 @@ function buildTreeFromBody() {
_pre.style.display === "none"
) {
_pre.style.removeProperty("display");
// only hide the select2 container when an alternative select found
element.style.display = "none";
return;
}
_pre = _pre.previousElementSibling;
@@ -528,8 +529,6 @@ function buildTreeFromBody() {
_next.style.display === "none"
) {
_next.style.removeProperty("display");
// only hide the select2 container when an alternative select found
element.style.display = "none";
return;
}
_next = _next.nextElementSibling;