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

🐛 Autocomplete select all: consider disabled items #3429

Merged
merged 6 commits into from
May 13, 2024

Conversation

oddvernes
Copy link
Collaborator

@oddvernes oddvernes commented May 8, 2024

resolves #3427

changes

  • moved defaultValue of optionDisabled to an external const so it does not break useMemo's where it is a dependency
  • "select all" now only selects/unselects items that are not disabled
  • "clear" button only unselects all selected items that are not disabled
  • "x/y selected" text - changed y from "all not disabled items length" to "all items length" (due to the fact that disabled items can still have selected state)

@oddvernes oddvernes marked this pull request as ready for review May 8, 2024 08:02
Copy link
Collaborator

@torleifhalseth torleifhalseth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :shipit:

@oddvernes
Copy link
Collaborator Author

I have now taken into account that a disabled item can be selected, and the "select all" toggle will only select/deselect items that are not disabled. I also made a change to the "x / y selected" text, where y used to be all items length - disabled items length, is now changed to all items length
But this also made me realize that our "clear all" button, the "x" in the input, clears disabled items as well if they are selected. So I have made a change there as well so "clear" only clears non-disabled items.

@oddvernes oddvernes merged commit 83a78c7 into develop May 13, 2024
6 checks passed
@oddvernes oddvernes deleted the OOVE/3427-autocomplete-select-all-disabled-items branch May 13, 2024 07:46
mhwaage pushed a commit to mhwaage/design-system that referenced this pull request Jul 29, 2024
* 🐛 Autocmplete: select all: consider disabled items

* optimize optionDisabled initialization

* consider selected disabled items in "select all"

* clear button: consider disabled selected items

* renaming variables

* update story
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When clicking select all in a controlled component, disabled options are also selected
3 participants