-
Notifications
You must be signed in to change notification settings - Fork 2
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
Character count #67
Comments
We've been trialling the word count aspect of this pattern on a DfE service for managing teacher training courses. In user research we’ve found that the word counts are clear and obvious and that users respond to them well, editing down their text to keep only what's most important. |
@fofr does your implementation include messaging for when users go over the number of words? Curious because I've had that in previous projects but not sure it was ever validated as a need. |
We're thinking about the possible error states for this component. In particular, how the 'You have 26 words too many' error should be represented in the error summary component that can appear at the top of a page. Just repeating that message wouldn't give context about which form field the error related to. As the example above from @fofr shows it's quite possible to have multiple character count components on a single screen - so, should the error be adjusted to include information about the specific field. For example "Interview process summary has too many words". However, if we only adjusted the error message in the summary then this would go against our advice to keep them the same. @stevenaproctor - do you have a take on this? |
@timpaul You could use the standard too long error message ‘[whatever it is] must be {x} [characters or words] or less’. Or, if it is available, you could use the number of characters you are over in the error message ‘[whatever it is] has {x} [characters or words] too many’. For the example, this would give you the errors:
What do you think? |
We have a need for a character count component in one of our services at HMRC. I noticed the github readme does not recommend using this component as-is in production - does anyone know what the blocker to recommendation is? |
Something new that we've observed in user research: We asked users to prepare content before our service was available. We gave them word count limits. We've found that users wrote their content in Word and used Word's word count feature to check the length. When they’ve then copied that content into our tool there's been a disparity between the two counts: ours is a little stricter and users have had to edit their content to reduce by 1 or 2 words. This has caused frustration, especially when the previous word document has been reviewed/approved. Presumably the logic for word counts in Word is a little more complex than the regex used in https://github.com/alphagov/ds-character-count. I doubt that there is consistent logic between different word processors, I like the simplicity of the regex used. (It's complicated a little by our use of markdown, where We still need to investigate the cause more thoroughly, but wanted to share this gotcha first. Edit: When we implemented server side word counts, we reused that regex so that frontend and backend would be consistent. |
valuable found @fofr. thanks a lot for sharing it with us. |
Has anybody tested this with screen readers yet? |
@hooperstu it was tested with screen readers and had a few user research rounds: https://github.com/alphagov/govuk-design-system/wiki/Character-count-testing-and-user-research The only issue I'm aware of is with JAWS who repeats field's label every time the count message is played. |
@alex-ju I tested it today with NVDA and Firefox and the remaining characters information was read out twice, which I did not expect. For example, when I entered the box and typed 'a' I heard 'You have 199 characters remaining' twice. When I deleted the 'a', I heard 'You have 200 characters remaining' twice as well. Any ideas? |
@stevenaproctor: thanks for reporting it. The prototype doesn't seem to have this issue. I will try to investigate what's causing the issue and get back to you. |
Hi @stevenaproctor, I did a bit of investigation around the NVDA issue, which seemed to be caused by the polling events. Updated the code in the Design System branch and tested again on NVDA. Please let me know if now is working as expected and thanks again for reporting it. |
@alex-ju It is working as expected, thanks for taking a look. If JavaScript is not available, is it possible to show "You have 200 characters remaining" rather than nothing? |
@stevenaproctor having a default message for non-JS experience sounds like a good idea; I'll look into it. But in this case the message should maybe mention the limit instead of the remaining characters |
@alex-ju Definitely. We tend to use something like "You can enter up to 200 characters". |
Working Group ReviewThis proposal was reviewed by a panel of designers from GDS, HMRC, DWP, EA and Home Office on Wednesday, 26th September 2018 The panel agreed that the pattern should be published in the GOV.UK Design System. The panel also made the following recommendations: Pre-publication
Future work
|
Thank you all for all the help to get this done, from research, code to guidance. As I mentioned in the working group, most - if not all - the credits for this work should go to @edwardhorsford. |
Great job team! Credit also to @alex-ju, Per, @hannalaakso, @alicenoakes and everyone else on the patterns team. |
It doesn't surprise me. The codebase was several versions behind the current one. |
@hannalaakso In response to comments from Malcolm and Ed, please remove the 'awaiting triage' status. |
For information: We investigated how many characters users actually submit. The service was https://www.gov.uk/send-rent-lease-details. It had a post-submit feedback question 'How can we improve this service' with a text field that allowed 1200 characters and a character count component. From 10,000 instances of user responses: 99% of users entered 632 characters or fewer; 99.8% entered 1000 characters or fewer. Make of that what you will. |
We’ve updated the character count componentWe’ve released an update for the character count component that fixes several accessibility issues. Visually, this updated character component looks identical. However, it improves the experience for people using screen readers. Here’s the updated component guidance: https://design-system.service.gov.uk/components/character-count/ Problems we wanted to solve for screen readersAnnouncing twicealphagov/govuk-frontend#2485 Announcing hint text with the character countalphagov/govuk-frontend#2486 Announcing below the thresholdalphagov/govuk-frontend#2487 Announcing old queued-up countsalphagov/govuk-frontend#2488 What we decided and what has changedWe decided that the character count’s screen reader experience needed to be improved. Since the initial launch of the component, both screen readers and browsers have had several rounds of updates. This has led to new behaviours that affected how screen readers announced updates to the character count, causing screen readers to provide long-winded, excessive, intrusive and sometimes out-of-date announcements. We reworked the character count component’s code to help solve the four issues we had identified. The biggest changes are:
We have also updated the component guidance to better align with how the updated component works and to highlight some of our new accessibility considerations. Known Issues
How you can helpWe are confident that this updated character count component provides an improved screen reader experience, but the changes haven’t been tested with actual users. If you or your team get a chance to test this component within a service, we would love to hear about any results relevant to the character count. If you come across any compatibility issues with this updated character count component, please let us know via this backlog item or through our regular support channels. How to upgradeTeams using the govuk-frontend Nunjucks macros do not have to make any changes. Teams using static HTML can remove the hard-coded For backwards compatibility, custom classes that have been added to the HTML count element are copied onto the visible, injected counter. If you previously used a custom class to change the visibility of the counter outside of the existing threshold functionality, this may no longer work as expected. The screen-reader-only counter does not inherit any classes. |
Hey folks, awesome work on the component. I am trying to use your approach as a starting point. But unfortunately, I came across this bug or maybe feature (trying to understand why it's happening): characterLimit.mp4In this particular example, the hint is getting renounced again at some point. I tried to google the issue but nothing really relates to this feature/bug. Does anybody come across it as well? Is there an explanation for this behaviour? Tested in Chrome 105 + VO and Safari 16 + VO I appreciate any help 🙌🏻 |
I was wondering if you can help. when using the component below. Character count – GOV.UK Design System (design-system.service.gov.uk) A new line is only counted as one character. However when it is sent to the backend it is counted as two character CRLF instead of LF. This means the character count in the front end mis-informs the user because it says the user is within the max length when in fact they are over due to an extra character for every new line not being counted. Is there a way round this so front and back end correlate. I saw this has been raised before but I see no resolution. Regards |
Hi @stephenjmcneill1971, thanks for flagging this! I don't have a quick answer for this, but it does look like this other ticket is also related to the bug you're seeing: alphagov/govuk-frontend#1104 It might be worth it to comment there around the concern of /n being considered 2 characters in the backend, but only being valued as 1 in the frontend. |
Hi @stephenjmcneill1971, I'm currently writing a response to your email now. I'll copy over any relevant bits here when I'm done. |
Hi David
Thanks for updating the other ticket with my comment.
Regards
Stephen
From: David C ***@***.***>
Sent: 10 January 2023 15:15
To: alphagov/govuk-design-system-backlog ***@***.***>
Cc: Stephen McNeill ***@***.***>; Mention ***@***.***>
Subject: Re: [alphagov/govuk-design-system-backlog] Character count (#67)
I was wondering if you can help. when using the component below.
Character count – GOV.UK Design System (design-system.service.gov.uk)<https://design-system.service.gov.uk/components/character-count/>
A new line is only counted as one character. However when it is sent to the backend it is counted as two character CRLF instead of LF. This means the character count in the front end mis-informs the user because it says the user is within the max length when in fact they are over due to an extra character for every new line not being counted. Is there a way round this so front and back end correlate.
I saw this has been raised before but I see no resolution. Character count · Issue #172 · nhsuk/nhsuk-service-manual-community-backlog (github.com)<nhsuk/nhsuk-service-manual-community-backlog#172>
Regards Stephen Joseph McNeill
Hi @stephenjmcneill1971<https://github.com/stephenjmcneill1971>, thanks for flagging this! I don't have a quick answer for this, but it does look like this other ticket is also related to the bug you're seeing: alphagov/govuk-frontend#1104<alphagov/govuk-frontend#1104>
It might be worth it to comment there around the concern of /n being considered 2 characters in the backend, but only being valued as 1 in the frontend.
—
Reply to this email directly, view it on GitHub<#67 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A4SNKXBNU5PTMC4HOB22SH3WRV4HVANCNFSM4ELSDXBA>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
***************************************************************************
CICA LEGAL NOTICE
This email and any files transmitted with it are private and intended solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please return it to the address it came from telling them it is not for you and then delete it from your system.
As part of conducting its business, the Criminal Injuries Compensation Authority may monitor and record incoming and outgoing emails and their content.
This email message has been swept for computer viruses.
***************************************************************************
|
This mismatch is, basically, the result of a difference in the specifications for HTML and HTTP. As our component only counts code points, and HTML/JS will only ever see one code point, we will always have a mismatch between what we have and what the backend actually receives when it comes to new lines. I don't think the solution is to change the character count component, however.
This does, unfortunately, leave the onus of how to validate all of this on the backend. As an interim solution for new lines specifically, it might be possible to detect and remove the carriage return characters from the received value before performing length validation. This would no longer suffice if we move to grapheme-based counting, however. |
Our service has a "personal statement" section where candidates have to write a longish (up to 600 words) statement about why they'd make a good teacher. We use the Character count component for this (but set to a word limit not a character limit). However we are noticing that quite a lot of users still submit the form with the personal statement over the word limit. Our assumptions are that one (or both) or the following might be the cause:
We’re currently exploring ways to potentially mitigate this. |
Sounds good, @frankieroberto, let us know what you find! |
Hi (also hi @stevenjmesser ) we're not Design System users here at Delib, but we use it as reference for Citizen Space UI. We have recently run into the same issues with character counts, and have had a crash course in graphemes. Watching with interest. |
We’ve come across an issue whereby when someone types into the text area box if there is a delay of about 1 second before they type another character in, the screen reader will read out the remaining character count, this continues to happen for the entire sentence they are writing. |
Hi @L-e-a-n-n-e-H, thanks for providing this feedback! I have a couple clarifying questions on the specific scenario, if you're able to provide more info. It's alright if you don't have answers for all the questions though. 👍
|
Hi @davidc-gds , many thanks for the quick reply, much appreciated!
In the meantime we were looking at what would be a good 'pause' length from the current 1000ms (1 second) and if anyone had any suggestions for this? Thank you! |
We ran an external accessibility audit for some of the components and patterns in GOV.UK Frontend in May 2023. In that audit, we included an example of the Character count component. We’re adding results from that audit here so that we can:
One usability accessibility issue raisedThe hidden character count only pops up when you approach threshold is strange usability-wise.
More detail in this issue: |
Just to note the threshold is an optional feature. We designed it with the aim that most fields would be large enough to accept most input, and not make the user have to think about the character/word limit. In the minority case where users might hit the limit, the threshold option allows those users to know they are near the limit. |
Use this issue to discuss the character count component.
The text was updated successfully, but these errors were encountered: