[Improvement] UI: Introduce "Autocomplete" for UI > Input > Field > Text#11008
[Improvement] UI: Introduce "Autocomplete" for UI > Input > Field > Text#11008mBeym wants to merge 1 commit intoILIAS-eLearning:trunkfrom
Conversation
3679cf9 to
1ecebe1
Compare
1ecebe1 to
cc37292
Compare
cc37292 to
8b3e45a
Compare
|
Hi all Why can't we not use the Tag-Input in these cases? I'm against using this for anything related to a user (as shown in the screen shots above). We should use consistent inputs for this. I would postulate that all inputs linked to user information MUST use the Tag-Input (or come up with a new User-input). Best, |
|
Hi @kergomard, Thanks for your reply. We (think we) understand your thoughts and concerns. First, the screenshot was just a quick example of how the autocomplete dropdown would look. The actual use case is selecting exactly one local role in the global authentication administration. An administrator needs to search through all local roles in the entire ILIAS installation to select one. Why Text-Input with Autocomplete?
Examples: searching for a local role name, a repository object, a location, etc. We do not expect that all consumers will use the Text-input element directly. However, we think developers from different domains can benefit from this general concept and build domain-specific wrappers around it—similar to how you built the "User" component using the Tag-input element. We think a Tag-input element is not suitable when the user must select exactly one entity. As a user, I would not expect to use a Tag-input (designed for multiple selections) when I need a Text-input (for a single selection) just because it's the only one with autocomplete functionality. This could also be relevant for plugin development (though plugins are not our primary focus in UI framework development), and we believe the community would appreciate this flexibility. I initially attempted to make the existing Tag-input usable for selecting exactly one value. However, this didn't work well with the Best regards, |
|
Thank you very much for the explanation @mBeym I still think this is a bad idea as there is a I clearly leave the general concept to the UI-Coordinators, but as the Authority for Thanks and best, |
|
|
|
That is perfectly fine behavior and does not change anything on what I say above. What I said above stands: I will not support any usage in |
There was a problem hiding this comment.
Hi @mBeym,
Thx a lot for your contribution to the UI framework!
I don't think the Field\Text input is the right choice either. I believe what you really need is one of the Field\HasOptionFilter components – maybe extended in some way.
It feels like your proposal is forcing the text input to serve a purpose it wasn't designed for. A text input accepts arbitrary strings, so supplying it with pre-assembled values to identify roles on the backend later on feels very unstructured. Results would be easily manipulated and additional JavaScript logic would be required to prevent (accidental) tampering.
Inputs like Field\Select or Field\Radio on the other hand provide a much more structured way to achieve this, since newly added data can be rendered as similar HTML elements, which cannot be easily tampered with. It also allows you to separate display-value and actual value to i.e. solve translation issues, which your proposal cannot.
Nonetheless, please answer the following questions:
- Async: I am unfamiliar with the use-case, but is it really necessary to load options async, or is filtering them enough? IMO if we are not talking about thousands of roles being loaded, I would simply send them synchronously.
Kind regards,
@thibsy (as UI coordinator)
|
In the example I made, selecting for a Local Role loading the options synchronously would mean showing/loading the roles for every object ILIAS has. I do think this should be done async. Edit: |
|
Hi @mBeym, Thx for the feedback. I can see how loading this asynchronously makes sense then. Could you have a look at this PR #8802, or the according examples inside the (latest) Kitchensink documentation, and tell me if this behaviour might fit your needs? From a technical standpoint, I feel very strongly that this kind of data-flow, with using string values from a text field, is just too brittle. If the look and feel of these Feel free to contact me here or on Discord to discuss this idea. Kind regards, |
|
Hi @thibsy, Thanks for pointing to the From our (I mean the community, not Databay :-)) users' perspective, this element would indeed fit their needs. @mBeym will have a look at the implementation of Best regards, |
This pr adds autocomplete similar to the already existing autocomplete for tag inputs or legacy ilTextInputGUI.
Why this is needed
Some views in ILIAS currently still use the legacy ilTexInputGUI. Since they need a text input with autocomplete, using ks inputs is not possible since there currently is no text input with autocomplete.