feat(MultiSelect): hide select all when search yields no results#577
Open
mrholek wants to merge 1 commit into
Open
feat(MultiSelect): hide select all when search yields no results#577mrholek wants to merge 1 commit into
mrholek wants to merge 1 commit into
Conversation
Add the `hideSelectAllOnSearchNoResults` option (default `true`). When a search filter leaves no matching options, the dropdown header with the built-in select all button is hidden, and restored once the search matches again. Set the option to `false` to keep the button visible. Custom `headerTemplate` headers are unaffected.
Coverage Report for CI Build 27610540826Coverage decreased (-0.04%) to 94.606%Details
Uncovered ChangesNo uncovered changes found. Coverage Regressions4 previously-covered lines in 2 files lost coverage.
Coverage Stats💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
hideSelectAllOnSearchNoResultsoption to the Multi Select component (defaulttrue).When
searchis enabled and the query matches no options, leaving the select all button above the empty "No results found" message is misleading — there is nothing left to select. By default the component now hides the dropdown header in that case and restores it as soon as the search matches at least one option again.Set
hideSelectAllOnSearchNoResults: falseto keep the header (and the select all button) visible even with no results. The option only affects the built-in select all button — a customheaderTemplateis always rendered.Changes
js/src/multi-select.js: newhideSelectAllOnSearchNoResultsconfig option, header reference tracking, and_updateSelectAllVisibility()wired into the search filter.docs/content/forms/multi-select.md: new "Hiding select all when search has no results" subsection (with two interactive examples) and an API table entry, markedadded-in 5.27.0.falseopt-out.Testing
karmaunit suite: 2971 passing.