Skip to content

Commit

Permalink
Only check comboboxTarget for validity
Browse files Browse the repository at this point in the history
  • Loading branch information
josefarias committed Mar 7, 2024
1 parent a116528 commit 331e877
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ Combobox.Validity = Base => class extends Base {
return !this._valueIsInvalid
}

// +_valueIsInvalid+ only checks if `comboboxTarget` (and not `_actingCombobox`) is required
// because the `required` attribute is only forwarded to the `comboboxTarget` element
get _valueIsInvalid() {
const isRequiredAndEmpty = this._actingCombobox.required && !this.hiddenFieldTarget.value
const isRequiredAndEmpty = this.comboboxTarget.required && !this.hiddenFieldTarget.value
return isRequiredAndEmpty
}
}

0 comments on commit 331e877

Please sign in to comment.