Skip to content

feat: add keyboard support to FluentAutoComplete in single-mode to delete selection #3844

Closed

Description

🙋 Feature Request

The PR #3571 added real single-mode to the FluentAutoComplete component by Steven Rasmussen (@StevenRasmussen)

Once you have made a selection there is no way to unselect the selection via keyboard again. The old way allowed to remove the item via backspace key or via a click on the x on the selected item or when the same item has been selected again. None of these ways is possible anymore when using single-mode.

🤔 Expected Behavior

I expect the component to remove the selection via backspace, delete and when the user unselects the same item again.

😯 Current Behavior

None of these way is possible anymore when using single-mode.

💻 Examples

See Multiple == false:
https://www.fluentui-blazor.net/Autocomplete

Activity

  1. added
    triage
    on May 28, 2025
  2. MarvinKlein1508 commented on May 28, 2025

    @MarvinKlein1508
    CollaboratorAuthor

    Steven Rasmussen (@StevenRasmussen) do you see any easy way to prevent stuff like this as well?

    Image

    I cannot tell you how often I have to tell my users that it is not a valid input here.

  3. StevenRasmussen commented on May 28, 2025

    @StevenRasmussen
    Contributor

    Maybe we remove the invalid text when focus is lost from the input?

  4. added
    status:needs-investigation
    community:contribution
    and removed
    triage
    on May 29, 2025
  5. vnbaaij commented on May 29, 2025

    @vnbaaij
    Collaborator

    I've labeled this with 'community contribution' as I expect (hope) you to come up with a solution (and a PR) for this

  6. MarvinKlein1508 commented on May 29, 2025

    @MarvinKlein1508
    CollaboratorAuthor

    Maybe we remove the invalid text when focus is lost from the input?

    This isn't as simple as it sounds because the control will lose it'S focus when you navigate through the elements in the list by keyboard or when you try to click at one.

  7. Tyme-Bleyaert commented on Jun 4, 2025

    @Tyme-Bleyaert
    Contributor

    I would like to give this a crack if you guys don't mind.

  8. vnbaaij commented on Jun 4, 2025

    @vnbaaij
    Collaborator

    Tyme-Bleyaert Absolutely. Have a go at it. I'll assign this to you

  9. Tyme-Bleyaert commented on Jun 4, 2025

    @Tyme-Bleyaert
    Contributor

    Ok, i think i got most things covered, only the following use case i need to work out:
    When a user selected a value, typed something extra after the value or typed invalid words.
    In the current case it will jump back to that last selected value. But maybe it would be better to clear the selected value when the value text no longer matches the last selected value.

    What do you guys think?

  10. MarvinKlein1508 commented on Jun 4, 2025

    @MarvinKlein1508
    CollaboratorAuthor

    I agree. What about you Vincent Baaij (@vnbaaij) ?

  11. vnbaaij commented on Jun 4, 2025

    @vnbaaij
    Collaborator

    When a user selected a value, typed something extra after the value or typed invalid words.
    In the current case it will jump back to that last selected value.

    And what about if a user deletes some chars from the beginning of the value? Can the last selected value than still be determined? Think going back to a blank solves a lot of ambiguity errors that can come of this

  12. Tyme-Bleyaert commented on Jun 6, 2025

    @Tyme-Bleyaert
    Contributor

    And what about if a user deletes some chars from the beginning of the value? Can the last selected value than still be determined? Think going back to a blank solves a lot of ambiguity errors that can come of this

    As long as the text matches the first item in the list it will reselect the item yes.
    I will continue working on it this weekend, as i did not have the time yet to do so.

  13. vnbaaij commented on Jun 6, 2025

    @vnbaaij
    Collaborator

    Tyme-Bleyaert No rush! I just kicked off the build for the v4.12.0 packages. You PR can go into the next release (which we could de as early as next week if we want to)

  14. Tyme-Bleyaert commented on Jun 6, 2025

    @Tyme-Bleyaert
    Contributor

    So that's why the documentation site is down?

  15. vnbaaij commented on Jun 6, 2025

    @vnbaaij
    Collaborator

    Looking into that right now. No idea why that happened.

  16. Tyme-Bleyaert commented on Jun 6, 2025

    @Tyme-Bleyaert
    Contributor

    Looking into that right now. No idea why that happened.

    looks like the site returns the Microsoft.FluentUI.AspNetCore.Components.Assets file as a js file instead of the Microsoft.FluentUI.AspNetCore.Components.lib.module.js from the dist folder. That's actually funny 😄

  17. vnbaaij commented on Jun 6, 2025

    @vnbaaij
    Collaborator

    Yes, saw that too. Really weird. Maybe a .NET 10 preview issue

  18. Tyme-Bleyaert commented on Jun 9, 2025

    @Tyme-Bleyaert
    Contributor

    Ok, I encountered some more things I'm not entirely happy with.
    Most of them I already fixed, but for instance when we have a disabled option as first result in the search results. When the users presses tab or enter, we should select the first non disabled result no? eg:

    Image
    Here I would expect "Austria" to be selected when pressing enter or tab.
    Also I'm not sure as to why in ListComponentBase<TOption>, OnSelectedItemChangedHandlerAsync(TOption? item) prevents null value when multiple is disabled. Does this not prevent us from clearing a selection back to its default value?

  19. vnbaaij commented on Jun 9, 2025

    @vnbaaij
    Collaborator

    Maybe Denis Voituron (@dvoituron) can answer that one?

  20. dvoituron commented on Jun 17, 2025

    @dvoituron
    Collaborator

    This keyboard support will be included in the next Release. See #3930

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

Metadata

Metadata

Assignees

Labels

community:contributionstatus:needs-investigation

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions