taiga-family / taiga-ui

Angular UI Kit and components library for awesome people
https://taiga-ui.dev
Apache License 2.0
3.1k stars 408 forks source link

🐞 - Combo resets search prematurely #2346

Open evantrimboli opened 1 year ago

evantrimboli commented 1 year ago

Which @taiga-ui/* package(s) are the source of the bug?

kit

Please provide a link to a minimal reproduction of the bug

https://taiga-ui.dev/components/combo-box#virtual

Is this issue blocking you?

Non-Blocking

Description

Assume in my list I have the following values:

By virtue of matching with the prefix, I never get the option to choose any other items that might be a partial match.

It seems like this area here is what causes the problematic behaviour:

https://github.com/Tinkoff/taiga-ui/blob/main/projects/kit/components/combo-box/combo-box.component.ts#L188

I think the filtering should only be cleared if the user clicks/keyboard selects the item. Possibly also if the field is blurred.

Angular version

14.0.0

Taiga UI version

2.57.0

Which browsers have you used?

Which operating systems have you used?

waterplea commented 1 year ago

@splincode I think this issue needs a careful evaluation. Purely disabling strict matching will render people unable to select anything but Canada, unless they erase the input value, which is not obvious and arguably worse than just typing a space after Canada when you expect some other result or stopping at Canad and picking from the options. I don't want to introduce reliance on clicking/blurring the control to update some superfluous internal state of acceptance. Maybe there's a way we can incorporate updateOn option from Angular form controls?

evantrimboli commented 1 year ago

I'm not sure if there's necessarily a problem with it selecting the value at that point, however it would be nice if it didn't reset the options. That way the value is still selected, but you have the chance to continue typing/selecting for something more specific.

waterplea commented 1 year ago

But you can continue typing currently. It resets options because otherwise once you typed Canada you will not see anything but Canada unless you erase some of it. And that's not good UX. People should be aware of other options, people should be able to filter options by typing in ComboBox. Both of these things now work.

evantrimboli commented 1 year ago

You can continue to type, however:

waterplea commented 1 year ago

I believe we specifically made it emit null in searchChange to signify that this is a match. Anyway, I'm keeping this open to think how we can improve this.