You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change the configuration options that the CharacterCount component accepts and:
separate the limit from the type of what's counted ("words" or "characters"), instead of having maxwords and maxlength combining both limit and type and requiring that one takes precedence over the other
clarify that the threshold is indeed a displayThreshold, not the character/words threshold
I'll also throw in the mix to allow configuring the display threshold as a percentage or absolute value, but I'm not familiar as to why this is done via percentage at the moment. I find more natural to think "limit to 200 characters, warn starting at 150" rather than "limit to 200 characters, warn at 75%", but this may very well be personal and the decision to use percentage has probably stronger grounds than my feelings. This doesn't necessarily require two attributes as we could use:
if the threshold is < 1, treat it as a percentage
if it is >= 1, treat it as an absolute value
It's worth noting about 1 that the internals of the component kind of make that separation:
maxwords and maxlength get translated into a unique maxLength instance variable
the presence of config.maxwords is used in if similarly to checking if type == 'words'
As we introduce the new API, we'd deprecate the old one, which we'd remove in the next breaking release.
And we'll obviously need to document all that 😉
What
Change the configuration options that the CharacterCount component accepts and:
separate the
limit
from thetype
of what's counted ("words"
or"characters"
), instead of havingmaxwords
andmaxlength
combining bothlimit
andtype
and requiring that one takes precedence over the otherclarify that the
threshold
is indeed adisplayThreshold
, not the character/words thresholdI'll also throw in the mix to allow configuring the display threshold as a percentage or absolute value, but I'm not familiar as to why this is done via percentage at the moment. I find more natural to think "limit to 200 characters, warn starting at 150" rather than "limit to 200 characters, warn at 75%", but this may very well be personal and the decision to use percentage has probably stronger grounds than my feelings. This doesn't necessarily require two attributes as we could use:
It's worth noting about 1 that the internals of the component kind of make that separation:
maxwords
andmaxlength
get translated into a uniquemaxLength
instance variableconfig.maxwords
is used inif
similarly to checking iftype == 'words'
As we introduce the new API, we'd deprecate the old one, which we'd remove in the next breaking release.
And we'll obviously need to document all that 😉
Why
Original idea was proposed by Ollie as part of this discussion when configuring the CharacterCount component via JS. While it didn't solve the issue at hand (having to override the JS config slightly differently for the component), it did seem like a good idea to the both of us, especially as it paves the route to fix #1364 (for 1).
Second and third point are smaller changes, but could add some clarity
Who needs to work on this
Developers, Technical writers
Who needs to review this
Developers, Technical writers
Done when
The text was updated successfully, but these errors were encountered: