Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textfield does not work "multiple" when "type=email" #5064

Closed
itagakishintaro opened this issue Oct 8, 2023 · 0 comments · Fixed by #5005 · May be fixed by X-oss-byte/pigweed#61, X-oss-byte/pigweed#70 or X-oss-byte/pigweed#73
Closed
Assignees

Comments

@itagakishintaro
Copy link

What is affected?

Component

Description

When I use text-field (md-outlined-text-field or md-filled-text-field) with type="email" multiple="true",
I expect a list of zero email addresses (an empty string, or one which is entirely whitespace) is a valid value.
It is common in W3C standard html.
See
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/email#multiple
However, textfield does not work.

Maybe, the cause is below. This code does not care about "multiple".

material-web/textfield/internal/text-field.ts
line 600

 private renderInputOrTextarea() {
    const style = {direction: this.textDirection};
    const ariaLabel =
        (this as ARIAMixinStrict).ariaLabel || this.label || nothing;
    // lit-anaylzer `autocomplete` types are too strict
    // tslint:disable-next-line:no-any
    const autocomplete = this.autocomplete as any;

    if (this.type === 'textarea') {
      return html`
        <textarea
          class="input"
          style=${styleMap(style)}
          aria-describedby="description"
          aria-invalid=${this.hasError}
          aria-label=${ariaLabel}
          autocomplete=${autocomplete || nothing}
          ?disabled=${this.disabled}
          maxlength=${this.maxLength > -1 ? this.maxLength : nothing}
          minlength=${this.minLength > -1 ? this.minLength : nothing}
          placeholder=${this.placeholder || nothing}
          ?readonly=${this.readOnly}
          ?required=${this.required}
          rows=${this.rows}
          .value=${live(this.value)}
          @change=${this.handleChange}
          @focusin=${this.handleFocusin}
          @focusout=${this.handleFocusout}
          @input=${this.handleInput}
          @select=${this.redispatchEvent}
        ></textarea>
      `;
    }

Reproduction

https://lit.dev/playground/#project=W3sibmFtZSI6Im1hdGVyaWFsLWltcG9ydHMuanMiLCJjb250ZW50IjoiaW1wb3J0ICdAbWF0ZXJpYWwvd2ViL3RleHRmaWVsZC9vdXRsaW5lZC10ZXh0LWZpZWxkLmpzJztcbiJ9LHsibmFtZSI6ImluZGV4Lmh0bWwiLCJjb250ZW50IjoiPCFET0NUWVBFIGh0bWw-XG48c2NyaXB0IHR5cGU9XCJtb2R1bGVcIiBzcmM9XCIuL21hdGVyaWFsLWltcG9ydHMuanNcIj48L3NjcmlwdD5cblxuPGZvcm0-XG4gIDxtZC1vdXRsaW5lZC10ZXh0LWZpZWxkXG4gICAgaWQ9XCJtZW1iZXJzXCJcbiAgICBsYWJlbD1cIm11bHRpcGxlIGVtYWlsXCJcbiAgICB0eXBlPVwiZW1haWxcIlxuICAgIG11bHRpcGxlPVwidHJ1ZVwiXG4gID48L21kLW91dGxpbmVkLXRleHQtZmllbGQ-XG4gIDxpbnB1dCB0eXBlPVwic3VibWl0XCI-XG48L2Zvcm0-In0seyJuYW1lIjoicGFja2FnZS5qc29uIiwiY29udGVudCI6IntcbiAgXCJkZXBlbmRlbmNpZXNcIjoge1xuICAgIFwibGl0XCI6IFwiXjIuMC4wXCIsXG4gICAgXCJAbGl0L3JlYWN0aXZlLWVsZW1lbnRcIjogXCJeMS4wLjBcIixcbiAgICBcImxpdC1lbGVtZW50XCI6IFwiXjMuMC4wXCIsXG4gICAgXCJsaXQtaHRtbFwiOiBcIl4yLjAuMFwiXG4gIH1cbn0iLCJoaWRkZW4iOnRydWV9XQ

Workaround

I do not know.

Is this a regression?

No or unsure. This never worked, or I haven't tried before.

Affected versions

@material/[email protected]

Browser/OS/Node environment

Browser: Chrome 117.0.5938.149
OS: MacOS 13.4.1 (c)(22F770820d)
Node version: v20.5.0
npm version: 10.1.0

copybara-service bot pushed a commit that referenced this issue Oct 10, 2023
@e111077 e111077 self-assigned this Oct 10, 2023
copybara-service bot pushed a commit that referenced this issue Oct 17, 2023
copybara-service bot pushed a commit that referenced this issue Oct 17, 2023
copybara-service bot pushed a commit that referenced this issue Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment