Skip to content

Commit

Permalink
Fix active value field detection for value fields containing a widget
Browse files Browse the repository at this point in the history
The method _getActiveValueField can not detect the active value field
for value fields that include a widget (e.g. a value field containing a
code editor widget), because the contained widget is not a value field
itself.

As a solution for this kind of fields look for the parents as well.
  • Loading branch information
torstentrompler committed Jul 18, 2023
1 parent ab634d4 commit afca6c5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions eclipse-scout-core/src/form/fields/ValueField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -678,10 +678,11 @@ export class ValueField<TValue extends TModelValue, TModelValue = TValue> extend
protected static _getActiveValueField(target: Element): ValueField<any> {
let $activeElement = $(target).activeElement(),
activeWidget = scout.widget($activeElement);
if (activeWidget instanceof ValueField && activeWidget.enabledComputed) {
return activeWidget;
if (activeWidget instanceof ValueField) {
return activeWidget.enabledComputed ? activeWidget : null;
}
return null;
const parent = activeWidget && activeWidget.findParent(parent => parent instanceof ValueField) as ValueField<any>;
return (parent && parent.enabledComputed) ? parent : null;
}
}

Expand Down

0 comments on commit afca6c5

Please sign in to comment.