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

Enhancement: Add clear affordance to combobox #3074

Closed
macandcheese opened this issue Sep 20, 2021 · 15 comments
Closed

Enhancement: Add clear affordance to combobox #3074

macandcheese opened this issue Sep 20, 2021 · 15 comments
Assignees
Labels
4 - verified Issues that have been released and confirmed resolved. c-combobox Issues that pertain to the calcite-combobox and related components design Issues that need design consultation prior to development. enhancement Issues tied to a new feature or request. estimate - 5 A few days of work, definitely requires updates to tests. p - high Issue should be addressed in the current milestone, impacts component or core functionality ready for dev Issues ready for development implementation.

Comments

@macandcheese
Copy link
Contributor

macandcheese commented Sep 20, 2021

Description

Follow up from Teams chat:

I'd like to propose adding a default clear button affordance, on single / multi select mode on combobox.

Consider these two comboboxes, both in (current) single mode:

https://jsbin.com/qodekogepi/1/edit?html,output

The first, as a user, is empty. If I select a value, I have no way to remove that now. The second, as a user, is already populated. This would be the use case for having a clear button, where the app needs a value there, whether it's a system default or a selection I've made in the past.

Adding "disableClear" would let apps remove the ability to clear this when needed.

Acceptance Criteria

To summarize proposal:

  • Always display a clear "x" affordance when the combobox is populated - in single select or in multi select.
  • Add a disableClear property to allow users to opt-out of displaying that clear "x" affordance, to basically create a "single-persist" mode without needing to add another mode option

Which Component

Combobox

@macandcheese macandcheese added enhancement Issues tied to a new feature or request. design Issues that need design consultation prior to development. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Sep 20, 2021
@julio8a julio8a added this to the Freezer milestone Sep 24, 2021
@julio8a julio8a removed the needs triage Planning workflow - pending design/dev review. label Sep 24, 2021
@macandcheese
Copy link
Contributor Author

Related : #2311

@macandcheese
Copy link
Contributor Author

@benelan @jcfranco - the icon placeholder / clear affordance has come up a few times since this issue. Could we bump priority on this a small bit?

@MonikaKanduri4525
Copy link

+1. We need the icon placeholder for the VTSE product.

@paulcpederson
Copy link
Member

paulcpederson commented Apr 18, 2022

+1 We'd love the single persist option as we use the single select combobox as a select menu where we want to always have an element selected.

@macandcheese
Copy link
Contributor Author

+1 We'd love the single persist option as we use the single select combobox as a select menu where we want to always have an element selected.

For this "single-persist" use case, would you expect to default selection to the first item if no children are set to active?

@paulcpederson
Copy link
Member

For our use case it's not super important as we have a default value that we always select up front. But would be good to allow either. Classic <select> element way to do this is to have a disabled option selected up front, which is sort of a hack, but they do allow for both:

    <select>
        <option value="none" selected disabled hidden>Select an Option</option>
        <option value="free">Free</option>
        <option value="starter">Starter </option>
        <option value="professional">Professional</option>
        <option value="corporate">Corporate</option>
    </select>

@benelan
Copy link
Member

benelan commented Apr 18, 2022

In my opinion, it shouldn't select the first item if none are active. It gives the dev more control, and they can always set one as active if they want.

@macandcheese
Copy link
Contributor Author

Re: select default : #4032

@driskull
Copy link
Member

@macandcheese maybe required property being true should prevent a user from being able to unselect a selected option? @paulcpederson suggested that in another issue.

Currently, it seems a user is always able to unselect the last selected item. Seems like we should prevent that somehow?

@macandcheese macandcheese changed the title Enhancement: Add single-persist mode to Combobox Enhancement: Add clear affordance to combobox, add disableClear property Jun 29, 2022
@macandcheese
Copy link
Contributor Author

From #4738 We could look at the behavior of MUI as an example - they by default have a clear affordance that is opt-out with disableClear - this could be combined with fixing the regression to solve all the requests in - #3074

Basically always prevent ability to "double click clear" in single-select, but have the clear affordance, which in your use case you would opt-out of with the prop... I think that sounds reasonable?

To summarize proposal:

Always display a clear "x" affordance when the combobox is populated - in single select or in multi select.
Add a disableClear property to allow users to opt-out of displaying that clear "x" affordance, to basically create a "single-persist" mode without needing to add another mode option
fix this bug as reported in single select.

@macandcheese macandcheese changed the title Enhancement: Add clear affordance to combobox, add disableClear property Enhancement: Add clear affordance to combobox Jul 22, 2022
@driskull
Copy link
Member

clearDisabled would be preferred to disableClear so the attribute is clear-disabled

@geospatialem geospatialem added the p - medium Issue is non core or affecting less that 60% of people using the library label Mar 3, 2023
@ashetland
Copy link
Contributor

Figma file is available for this. cc @jcfranco

@ashetland ashetland removed their assignment May 17, 2023
@ashetland ashetland added ready for dev Issues ready for development implementation. and removed design Issues that need design consultation prior to development. labels May 17, 2023
@geospatialem geospatialem added 0 - new New issues that need assignment. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed 1 - assigned Issues that are assigned to a sprint and a team member. labels May 18, 2023
@geospatialem geospatialem removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label May 18, 2023
@geospatialem
Copy link
Member

Update will be encompassed as part of #4738

@geospatialem geospatialem added 2 - in development Issues that are actively being worked on. figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists and removed 0 - new New issues that need assignment. labels May 18, 2023
@jcfranco jcfranco added 3 - installed Issues that have been merged to master branch and are ready for final confirmation. and removed 2 - in development Issues that are actively being worked on. labels May 18, 2023
@geospatialem geospatialem added 4 - verified Issues that have been released and confirmed resolved. and removed 3 - installed Issues that have been merged to master branch and are ready for final confirmation. labels May 19, 2023
@geospatialem
Copy link
Member

Verified in 1.4.0-next.22

combobox-same-option-blank

jcfranco added a commit that referenced this issue May 26, 2023
**Related Issue:** #4738, #3074

## Summary

This reverts the fix for #4738 to prevent breaking existing user
workflows that rely on clicking an item to deselect.
@ashetland ashetland added the design Issues that need design consultation prior to development. label Sep 18, 2023
@SkyeSeitz SkyeSeitz removed the figma changes Issues that require additions or updates to the Figma UI Kit where no `design` label exists label Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4 - verified Issues that have been released and confirmed resolved. c-combobox Issues that pertain to the calcite-combobox and related components design Issues that need design consultation prior to development. enhancement Issues tied to a new feature or request. estimate - 5 A few days of work, definitely requires updates to tests. p - high Issue should be addressed in the current milestone, impacts component or core functionality ready for dev Issues ready for development implementation.
Projects
None yet
Development

No branches or pull requests