VariableControls: Adjust variable selection in edit mode (#113408)
* adjust variable selection logic * clean up * adjust attribute used
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user