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

[select] Placeholder is not shown when there are no items #6742

Open
MatthewVaadin opened this issue Oct 24, 2024 · 0 comments
Open

[select] Placeholder is not shown when there are no items #6742

MatthewVaadin opened this issue Oct 24, 2024 · 0 comments

Comments

@MatthewVaadin
Copy link

Description

If I have a Select component with no items set and a placeholder text set, the placeholder text is not shown. If the select has items, the placeholder is shown.

image

Expected outcome

I would expect the placeholder text to be shown whether there are any items or not.

Minimal reproducible example

Select<String> emptySelect = new Select<>();
emptySelect.setLabel("Empty select");
emptySelect.setPlaceholder("Select an item");
add(emptySelect);

Select<String> unselectedSelect = new Select<>();
unselectedSelect.setItems("One", "Two", "Three");
unselectedSelect.setLabel("Unselected select");
unselectedSelect.setPlaceholder("Select an item");
add(unselectedSelect);

Steps to reproduce

  1. Add the snippet above to a view.
  2. Visit the view and notice that the top select has no placeholder, whereas the bottom one has.

Environment

Vaadin version(s): 24.5

Browsers

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants