Displaying results counts for facet options in Instant Results #2563
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.
Description of the Change
Adds result counts for facet options in Instant Results.
Closes #2526.
Alternate Designs
Design-wise there could be any number of variations, but as the default I stuck with simple numbers in parentheses. To support users and themes styling the counts differently, such as in a bubble or similar, the counts have their own element, and parentheses are added with CSS so that they can be removed with CSS. From testing with VoiceOver there was no difference in accessibility in using CSS for the parentheses.
With this PR the counts are enabled by default, with no setting to choose to enable or disable them, however they occupy their own element so they can be easily hidden with a single line of CSS.
Possible Drawbacks
N/A
Verification Process
With this PR checked out the counts should be visible next to filter options in Instant Results. Selecting filter options should narrow down the number of results to the number next to each option, and the counts next to any remaining options should be updated to reflect the number of matching results in the current result set.
Checklist:
Changelog Entry
Displaying results counts for facet options in Instant Results.
Credits
Props @JakePT