-
Notifications
You must be signed in to change notification settings - Fork 1k
fix selectAll showing when limit #7245
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In SelectedValuesDisabled can we change the if statement on line 54 to
if (
value.length === disabledSelected ||
selectedInSearch().length === disabledSelected
)
This prevents an issue where the values selected after searching are disabled and the button shows 'clear all' even though nothing can be cleared because they are all disabled
@@ -68,7 +68,7 @@ const SelectionSummary = ({ | |||
value?.length === 0 || | |||
selectedValuesDisabled() || | |||
!value || | |||
selectedInSearch().length === 0 | |||
(!limit && selectedInSearch().length === 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this change? I didn't see a difference in behavior with vs without it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch yes we dont need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Behavior looks good, but to summarize from Slack discussion I'll wait to review further until be refactor the select all/clear all logic to be separate and more readable.
What does this PR do?
This PR fixes
selectAll
being shown when there is a limit.Where should the reviewer start?
SelectionSummary
What testing has been done on this PR?
storybook & jest test
How should this be manually tested?
Create a SelectMultiple component where limit property is provided
Don't select anything. Search something that exists, the Select All does not get displayed.
Clear the search and select any option from dropdown.
Search with a keyword that does not match the selected value but matches other values in the list.
Select All option gets displayed.
Do Jest tests follow these best practices?
screen
is used for querying.asFragment()
is used for snapshot testing.Any background context you want to provide?
What are the relevant issues?
closes #7219
Screenshots (if appropriate)
Do the grommet docs need to be updated?
no
Should this PR be mentioned in the release notes?
yes
Is this change backwards compatible or is it a breaking change?
backwards compatible