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

Start counting selected options at 1 #2403

Closed
wants to merge 2 commits into from

Conversation

nbdavies
Copy link

@nbdavies nbdavies commented Feb 26, 2020

This PR addresses issue #2367 : currently if set selectedTextFormat to count or count > 0, when the user selects one option, the text displayed can be determined using countSelectedText unless the user happens to select only one option, and then that one option is displayed. That can look very inconsistent, especially if the <select> has a limited width and the selected option is longer.

The change here just fixes the selectedCount threshold at which the countSelectedText function comes into play (from 2 to 1). Test cases are included. I don't think the documentation needs to be updated, since that's already accurate:

[countSelectedText] Sets the format for the text displayed when selectedTextFormat is count or count > #. {0} is the selected amount. {1} is total available for selection.

[selectedTextFormat] 'count' displays the total number of selected options. 'count > x' behaves like 'values' until the number of selected options is greater than x; after that, it behaves like 'count'.

This could be considered a breaking change to anyone who's expecting/relying on the previous behavior, but it's easy to get back the previous behavior by setting selectedTextFormat to count > 1

@mikemix
Copy link

mikemix commented Mar 19, 2020

Are we merging this?/

@caseyjhol
Copy link
Member

caseyjhol commented Mar 27, 2021

Ideally, count behavior would remain unchanged and only support for count > 0 would be added. This would reduce the chances of this breaking someone's setup.

Edit: support for count > x has been added here: 036d0db and will be available in the next release after v1.14.0-beta2.

@caseyjhol caseyjhol closed this Mar 27, 2021
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.

3 participants