VariableControls: Adjust variable selection in edit mode (#113408)

* adjust variable selection logic

* clean up

* adjust attribute used
This commit is contained in:
Sergej-Vlasov
2025-11-06 10:27:26 +00:00
committed by GitHub
parent 1b278cc87e
commit 71d511abd8
@@ -56,10 +56,16 @@ export function VariableValueSelectWrapper({ variable, inMenu }: VariableSelectP
}
// Ignore click if it's inside the value control
if (evt.target instanceof Element && !evt.target.closest(`label`)) {
// Prevent clearing selection when clicking inside value
evt.stopPropagation();
return;
if (evt.target instanceof Element) {
// multi variable options contain label element so we need a more specific
// condition to target variable label to prevent edit pane selection on option click
const forAttribute = evt.target.closest('label[for]')?.getAttribute('for');
if (!(forAttribute === `var-${variable.state.key || ''}`)) {
// Prevent clearing selection when clicking inside value
evt.stopPropagation();
return;
}
}
if (isSelectable && onSelect) {