Sha256: fb643c0696fa834a3f85c14efb7589737eaf2507aa7772f698a42e7e8ef5a179
Contents?: true
Size: 1.13 KB
Versions: 9
Compression:
Stored size: 1.13 KB
Contents
import Combobox from "hw_combobox/models/combobox/base" Combobox.Validity = Base => class extends Base { _markValid() { if (this._valueIsInvalid) return this._forAllComboboxes(combobox => { if (this.hasInvalidClass) { combobox.classList.remove(this.invalidClass) } combobox.removeAttribute("aria-invalid") combobox.removeAttribute("aria-errormessage") }) } _markInvalid() { if (this._valueIsValid) return this._forAllComboboxes(combobox => { if (this.hasInvalidClass) { combobox.classList.add(this.invalidClass) } combobox.setAttribute("aria-invalid", true) combobox.setAttribute("aria-errormessage", `Please select a valid option for ${combobox.name}`) }) } get _valueIsValid() { 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.comboboxTarget.required && this._hasEmptyFieldValue return isRequiredAndEmpty } }
Version data entries
9 entries across 9 versions & 1 rubygems