-
Notifications
You must be signed in to change notification settings - Fork 323
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
CharacterCount doesn't render or initialise properly if maxlength
or maxwords
is not passed to the macro
#2910
Comments
This happens with the current version of However the macro still outputs an untidy text and we could either hide it as I initially suggester (using |
Yeah, unfortunately I think this has been around a while – see also #1725. I think it'd be nice to fix this in v4.4.0, but I don't think this is a regression. |
That was just something I noticed while preparing my demo yesterday juggling between the 4.3.1 and main versions, but I prefered flagging to keep track of it. For the JavaScript bit, thinking about it, without any default for Regarding the HTML from the macro, thanks for linking to the old issue. I think with the introduction of |
As a quick bit of background, we did some changes to the character counter functionality earlier this year to fix bugs and improve the screen reader experience in a number of browsers and technologies (see PR #2577 for the long read). Consequentially, the counter is a bit of a complex web of visible (sometimes) and hidden (sometimes) elements. It may be best to avoid any solution that involves changing the visibility of elements, as this may have repercussions on those past changes, requiring some extensive re-testing! |
Cheers, that's some handy stuff to be aware. I had noticed the separate visible and debounced screen-reader feedback in the JavaScript side. I think that part should be left alone indeed: no maxlength, no maxwords -> no extra feedback if you don't set one when configuring JavaScript sounds a fine way to do. Regarding a HTML cleanup, I think there's all the options for whatever people want to do:
|
What
It's a two part thing:
First is the HTML part, before JS kicks in: if omitting the
maxlength
ormaxwords
option when calling thegovukCharacterCount
macro, the HTML rendered displays a "You can enter up to undefined characters" message.Second is the JavaScript part: When initialising the component with a JavaScript
maxlength
ormaxwords
config, the message disappears, but doesn't get replace by a count of the remaining character.This will be problematic for people looking to use the JavaScript configuration to set a blanket setting accross their service. For that to work, we need to render the component without a
data-maxwords
ordata-maxlength
attribute and fix the HTML part.And then once that's through, we need to make sure the component initialises OK with a missing length.
Who needs to work on this
Developers
Who needs to review this
Developers
Done when
maxwords
ormaxlength
are providedmaxwords
ormaxlength
The text was updated successfully, but these errors were encountered: