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

MultiSelectComboBox keepFilter mode behavior is not consistent #8067

Open
TatuLund opened this issue Oct 31, 2024 · 0 comments
Open

MultiSelectComboBox keepFilter mode behavior is not consistent #8067

TatuLund opened this issue Oct 31, 2024 · 0 comments
Labels
needs discussion No decision yet, discussion needed refactor Internal improvement vaadin-multi-select-combo-box

Comments

@TatuLund
Copy link
Contributor

TatuLund commented Oct 31, 2024

Description

Keyboard and mouse use cases with MultiSelectComboBox have different out comes when keepFilter = true.

Expected outcome

Use cases A) and B) to be the same.

Minimal reproducible example

@Route(value = "multiselect-issue", layout = MainLayout.class)
public class MultiSelectIssueView extends VerticalLayout {

	public MultiSelectIssueView() {
		setSizeFull();
		setPadding(true);
		MultiSelectComboBox<String> tagInput = new MultiSelectComboBox<>("Tags");
		var dataView = tagInput.setItems("turku", "turkmenistan", "tupolev", "turkey");
		tagInput.setAllowCustomValue(true);
		tagInput.setKeepFilter(true);
		tagInput.addCustomValueSetListener(e -> {
			var newTag = e.getDetail();
			dataView.addItem(newTag);
			var selected = new HashSet<>(tagInput.getValue());
			selected.add(newTag);
			tagInput.setValue(selected);
		});
		add(tagInput);
		tagInput.addValueChangeListener(e -> {
			Notification.show(e.getValue().stream().collect(Collectors.joining(",")));
		});
	}
}

Steps to reproduce

The sequence A)

  1. type "tu" in the input
  2. click Turku
  3. click outside the MultiSelectComboBox

After step 2. only Turku is selectedAfter step 3. it commits "tu" as a new value and selects it

On the other hand sequence B)

  1. type "tu" in the input
  2. press cursor down
  3. press enter, selects turku, "tu" remains as input (keep filter)
  4. press tab to focus out, does not commit "tu" as new value

I would expect these to be the same. I.e. in both cases "tu" commited or not committed

Especially as if you do

  1. type "tu"
  2. press tab -> "tu" will be committed and selected

or

  1. type "tu"
  2. click outside -> "tu" will be committed and selected

Which are the same

One could claim that the first use case A) is sort of correct, although not desired in all circumstances. 

Environment

Vaadin version(s): 23.5.8, 24.4.

Browsers

No response

@yuriy-fix yuriy-fix added refactor Internal improvement needs discussion No decision yet, discussion needed vaadin-multi-select-combo-box labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs discussion No decision yet, discussion needed refactor Internal improvement vaadin-multi-select-combo-box
Projects
None yet
Development

No branches or pull requests

2 participants