neo icon indicating copy to clipboard operation
neo copied to clipboard

form.field.Select: onFocusLeave() no longer clearing values with forceSelection

Open tobiu opened this issue 1 year ago • 1 comments

The bug occured inside our client app and needs investigation.

The new logic seems wrong: if the widget is using the forceSelection config, non matching values need to get cleared. Without the config, arbitrary entries are allowed and must not get cleared.

    onFocusLeave(data) {
        let me = this;

        if (!me.record) {
            if (me.forceSelection) {
                me.value = me.forceSelection ? me.activeRecordId : null;
            }
            // If we exit without selecting a record, clear the filter input value.
            else {
                me.getInputEl().value = '';
            }
        }

        // Clear any typeahead hint
        me.updateTypeAheadValue('');

        // The VDOM must not carry the empty string permanently. Only while clearing the value.
        if (!me.record && !me.forceSelection) {
            delete me.getInputEl().value;
        }

        super.onFocusLeave(data)
    }

@ExtAnimal

tobiu avatar Feb 12 '24 14:02 tobiu

I think it is related to the change from hintRecordId to activeRecordId, which have a different purpose.

hint => the not selected record which matches via autoComplete

we now also have activeRecord and record, which have the same purpose.

tobiu avatar Feb 12 '24 16:02 tobiu