Skip to content

Commit

Permalink
fix(select): remote do not validate and return input value on blur
Browse files Browse the repository at this point in the history
  • Loading branch information
hirsch88 committed Nov 30, 2022
1 parent a3138b1 commit 5618faa
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ export class Select implements ComponentInterface, Loggable {
const hasOptions = this.options.size > 0

if (hasOptions) {
this.syncRawValue(false)
if (!this.remote) {
this.syncRawValue(isNotHuman)
}
} else {
this.waitForOptionsAndThenUpdateRawValuesTimer = setTimeout(() => this.waitForOptionsAndThenUpdateRawValues(), 10)
}
Expand Down Expand Up @@ -505,10 +507,10 @@ export class Select implements ComponentInterface, Loggable {
}
}
this.options = new Map(options)
if (!this.remote) {
if (!this.typeahead) {
await this.syncNativeInput()
}
if (this.didInit) {
if (this.didInit && !this.remote) {
this.validateAfterBlur()
}
}
Expand Down Expand Up @@ -753,8 +755,8 @@ export class Select implements ComponentInterface, Loggable {

private validateAfterBlur(isHuman = isNotHuman) {
let newRawValue = this.rawValue
if (this.didInit && !this.multiple && !this.remote) {
if (this.selectionOptional && this.typeahead) {
if (this.didInit && !this.multiple) {
if (this.typeahead && (this.selectionOptional || this.remote)) {
const typedOption = findOptionByLabel(this.options, this.inputElement.value)
if (typedOption) {
newRawValue = [typedOption.value]
Expand Down

0 comments on commit 5618faa

Please sign in to comment.