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

PiT 24.5: combo-box with allow-custom-value does not update the component value #7789

Closed
Tracked by #6634
manolo opened this issue Sep 10, 2024 · 3 comments
Closed
Tracked by #6634
Labels
documentation Improvements or additions to documentation vaadin-combo-box

Comments

@manolo
Copy link
Member

manolo commented Sep 10, 2024

Description

  • When I add a combo-box to my UI (Flow or Hilla) and enable custom-value, the value I type is not reflected to the value property in the element. See screenshot showing $0.value is empty:

Screenshot 2024-09-10 at 14 16 52

  • If I select an item in the list, and write something in the input field, the item keeps checked, as it's shown in the screenshot:

Screenshot 2024-09-10 at 14 17 15

Expected outcome

value is updated, and it has value in the element as well as in the flow component

Minimal reproducible example

Try this code

  @state()
  private items = ['Chrome', 'Edge', 'Firefox', 'Safari'];

  protected override render() {
    return html`
      <vaadin-combo-box
        allow-custom-value
        label="Browser"
        helper-text="Select or type a browser"
        .items="${this.items}"
      ></vaadin-combo-box>
    `;
  }

Steps to reproduce

Show demo in the components documentation: https://vaadin.com/docs/latest/components/combo-box#custom-value-entry

Environment

Vaadin version(s): 24.5.0.alpha15, and most probably previous versions

Browsers

No response

@web-padawan
Copy link
Member

Confirmed with the Flow component example (the web component seems to work fine).

@web-padawan
Copy link
Member

UPD: this is actually how the Flow component works according to JavaDoc:

Note that ComboBox doesn't do anything with the custom value string automatically. Use the {@link #addCustomValueSetListener(ComponentEventListener)} method to determine how the custom value should be handled. For example, when the ComboBox has {@code String} as the value type, you can add a listener which sets the custom string as the value of the ComboBox with {@link #setValue(Object)}.

The second Flow example is doing exactly that using addCustomValueSetListener.

@web-padawan web-padawan added the documentation Improvements or additions to documentation label Sep 11, 2024
@web-padawan
Copy link
Member

Closing as this works as intended as discussed internally.

@web-padawan web-padawan closed this as not planned Won't fix, can't repro, duplicate, stale Sep 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation vaadin-combo-box
Projects
None yet
Development

No branches or pull requests

2 participants