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

Increase amount of text in character count threshold example #2975

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

querkmachine
Copy link
Member

Increases the amount of text in the Character Count's 'threshold' example, to better reflect the intended usage being fields with very high character limits that a user is unlikely to encounter naturally.

Suggested by @davidc-gds on alphagov/govuk-frontend#3689.

Thoughts

I'm personally a little dubious as to the efficacy of this change, for a couple of reasons:

  • It makes the HTML/Nunjucks examples harder to parse, as now a significant portion of them are taken up by the placeholder text.
  • In my mind, a limit of 800 characters (as in David's suggestion) or 840 characters (as in this PR) is still much lower than the intended use for the threshold feature.
    • In my mind, the threshold feature is best used where the only limit to value length is technical, such as MySQL's text type having a limit of ≈64,000 characters. This is a limitation a user is unlikely to actually reach in normal use, but one that does technically exist, so only flagging it if the user is approaching it is sensible. This doesn't feel as appropriate for limits of only one or two thousand characters.

@netlify
Copy link

netlify bot commented Jul 25, 2023

You can preview this change here:

Name Link
🔨 Latest commit 86fad87
🔍 Latest deploy log https://app.netlify.com/sites/govuk-design-system-preview/deploys/64c3cf296edef700082a6b04
😎 Deploy Preview https://deploy-preview-2975--govuk-design-system-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@claireashworth
Copy link
Contributor

I'm not sure I understand. What problem are we trying to solve by increasing the amount of text in the example? And does it have to be random text? Could it literally say something about users have an almost unlimited text field to add information to emphasise the point of this section?

@calvin-lau-sig7
Copy link
Contributor

From what I understand the purpose of the 'threshold' feature is to let service teams put in a character count in situations where there's a relatively high character limit in place, but the user is very unlikely to reach it (as it should be relatively short response).

This was raised by a user in testing as an accessibility issue for this reason — that:

I would likely not have been aware of the character limit until I had typed this number of characters which may have led to me needing to re-evaluate what I wanted to enter.

But... that is the intended use case, and that the vast majority of users shouldn't ned to be aware of it.

David's suggestion is to show a more "realistic" example, with a high threshold.

As for placeholder text... I'm not sure how we illustrate an overly-long or rambling example in a clear way. Hmm!

@claireashworth
Copy link
Contributor

oh ok. so some thoughts - we could change the title of this section, so instead of an instruction it's more of a description of what this option in character count provides. This would be consistent with the other subheads. We could also do a sense check of the content to see if we can explain it more clearly.
In the example box, the text is currently 83 characters. We could potentially re-write the example text as instructions. This might duplicate the content, but I think that could work better as it remains in the context of the component. So literally something like - 'This text box does not have a character limit. It will start showing you the character count after you've typed 50 characters. Add more text to this text box to see the character count.'

I think doing something along these lines will answer the accessibility audit concerns by clarifying what this example is showing. The only reason I'm not keen on the gov.uk text is I didn't instinctively understand why it was there.

@calvin-lau-sig7
Copy link
Contributor

Oh, I like that idea. It's a good way to avoid putting in what'd likely be meaningless placeholder text, by using it for a literal purpose (rather than the typical 'hypothetical service' text we usually use ).

@querkmachine
Copy link
Member Author

N.B. I used random GOV.UK content for the placeholder as that is what seems to be used in the error message example further down the page. https://design-system.service.gov.uk/components/character-count/#error-messages

Comment on lines 21 to 22
maxlength: 840,
threshold: 80,

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know it's a cumbersome ask because it would require more content, but is there any way we can get the threshold to be more like a 75%+ threshold, to be more realistic? I can't think of a use-case where we would want to activate the threshold condition at something as low as 26%.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a suggested update tot he content which should bring it to around 849 characters. Then we can go for an 85% threshold on a 100 character limit.

Copy link
Contributor

@calvin-lau-sig7 calvin-lau-sig7 Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To go with ~850 character textareaValue value suggested above

Suggested change
maxlength: 840,
threshold: 80,
maxlength: 1000,
threshold: 85,

Comment on lines 9 to 15
Type more letters into this field after this message to see the threshold feature.

GOV.UK includes services, information and guidance that only government can provide. It’s designed so that users do not need to understand the complex structures of government in order to complete their task. Its content and design is user-centred so that interacting with government is accessible to everybody.

GOV.UK is the official source of government information. It is impartial so that people trust the content they find.

Content and services are continually improved to meet user needs. You can visit the GOV.UK roadmap for the most up to date plan for future improvements.

This comment was marked as outdated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend for screen reader users that we put the most important info at the top, and then add a note that all the text after a certain point is filler text.

Something like this maybe?

Suggested change
Type more letters into this field after this message to see the threshold feature.
GOV.UK includes services, information and guidance that only government can provide. It’s designed so that users do not need to understand the complex structures of government in order to complete their task. Its content and design is user-centred so that interacting with government is accessible to everybody.
GOV.UK is the official source of government information. It is impartial so that people trust the content they find.
Content and services are continually improved to meet user needs. You can visit the GOV.UK roadmap for the most up to date plan for future improvements.
This example of a textarea has a character limit of 1000 characters. The character count is hidden, but will appear when there are more than 850 characters entered into this textarea. Type some more text into this textarea to see the character count appear.
Beyond this sentence, all text in this text area is filler-text, for demonstration purposes.
GOV.UK includes services, information and guidance that only government can provide. It is designed so that users do not need to understand the complex structures of government in order to complete their task. Its content and design is user-centred so that interacting with government is accessible to everybody.
GOV.UK is the official source of government information. It is impartial so that people trust the content they find.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, in that case we could perhaps just repeat the paragraph, will suggest shortly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep that works too! Just something to let screen reader users know that "everything beyond this point is trash" 😛
And then we can add trash!

Copy link
Contributor

@calvin-lau-sig7 calvin-lau-sig7 Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

844 characters, to go with new suggested threshold settings in example:

Suggested change
Type more letters into this field after this message to see the threshold feature.
GOV.UK includes services, information and guidance that only government can provide. It’s designed so that users do not need to understand the complex structures of government in order to complete their task. Its content and design is user-centred so that interacting with government is accessible to everybody.
GOV.UK is the official source of government information. It is impartial so that people trust the content they find.
Content and services are continually improved to meet user needs. You can visit the GOV.UK roadmap for the most up to date plan for future improvements.
This example of a textarea has a character limit of 1000 characters. The character count is hidden, but will appear when there are more than 850 characters entered into this textarea. Type some more text into this textarea to see the character count appear. This paragraph is repeated below.
This example of a textarea has a character limit of 1000 characters. The character count is hidden, but will appear when there are more than 850 characters entered into this textarea. Type some more text into this textarea to see the character count appear. This paragraph is repeated below.
This example of a textarea has a character limit of 1000 characters. The character count is hidden, but will appear when there are more than 850 characters entered into this textarea. Type some more text into this textarea to see the character count appear.

@calvin-lau-sig7
Copy link
Contributor

oh ok. so some thoughts - we could change the title of this section, so instead of an instruction it's more of a description of what this option in character count provides. This would be consistent with the other subheads. We could also do a sense check of the content to see if we can explain it more clearly. In the example box, the text is currently 83 characters. We could potentially re-write the example text as instructions. This might duplicate the content, but I think that could work better as it remains in the context of the component. So literally something like - 'This text box does not have a character limit. It will start showing you the character count after you've typed 50 characters. Add more text to this text box to see the character count.'

I think doing something along these lines will answer the accessibility audit concerns by clarifying what this example is showing. The only reason I'm not keen on the gov.uk text is I didn't instinctively understand why it was there.

Hello! I've made 2 suggestions meant to be committed together.
I've also separately committed a guidance edit to add the heading.

I feel fine with the 'job description' text in the Error message bit.

If the limit is much higher than most users are likely to reach, you can choose to only display the message after a user has entered a certain amount.
#### If the limit is far higher than users are likely to reach

You can choose to display a character count message only after the user has entered a certain number of characters. This is useful when a character limit is needed, but users are unlikely to reach the limit.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, it's not about the user entering characters, it's down to a threshold being passed. For example, if the text area is pre-filled, that'll activate the threshold condition as well.

Suggested change
You can choose to display a character count message only after the user has entered a certain number of characters. This is useful when a character limit is needed, but users are unlikely to reach the limit.
You can choose to display a character count message only after the length of the text has surpassed a certain 'threshold' number of characters. This is useful when a character limit is needed due to the technical limitations of the service, but users are unlikely to reach the limit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a teensy bit misleading now as it implies that the threshold is set based on the number of characters, when it's actually a percentage of the total limit.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about just removing the word 'number' entirely then?

You can choose to display a character count message only after the length of the text has surpassed a certain 'threshold' of characters. This is useful when a character limit is needed due to the technical limitations of the service, but users are unlikely to reach the limit.

Copy link
Contributor

@calvin-lau-sig7 calvin-lau-sig7 Jul 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, this sentence is meant to be a bit of preamble, explaining the experience from the user perspective, before introducing the threshold in the following paragraph.

Do we want to keep working on shaping this sentence, and edit the next paragraph?

Either way we'd need to edit both paragraphs to action on @davidc-gds's original comment as a separate commit:

You can choose to display a character count message if the length of text within the textarea more than a certain 'threshold' of characters. This is useful when a character limit is needed due to the technical limitations of the service, but users are unlikely to reach the limit.

To do this, set the threshold in the component markup as a percentage. For example, data-threshold="75" will show the count message only when users have entered 75% of the limit.

@querkmachine querkmachine force-pushed the character-count-threshold-increase-text branch from a5fc120 to ca5b02e Compare July 28, 2023 09:43
@querkmachine
Copy link
Member Author

@calvin-lau-sig7 @davidc-gds I think I've captured and pushed the most recent content suggestions now. Please give 'em a look through just in case I've missed anything!

@dav-idc dav-idc self-requested a review July 28, 2023 10:53
Copy link
Contributor

@dav-idc dav-idc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good from my side now! Once the others take a look, should be good to go. 🙌

@calvin-lau-sig7
Copy link
Contributor

Thanks @querkmachine, I think we're close! I've added some minor amends, I'm happy to commit with an okay. Otherwise I'll be happy to approve from here.

@querkmachine querkmachine merged commit 6ff64ee into main Jul 28, 2023
10 checks passed
@querkmachine querkmachine deleted the character-count-threshold-increase-text branch July 28, 2023 14:42
@dav-idc
Copy link
Contributor

dav-idc commented Jul 28, 2023

Awesome! Great job, everyone! 🚀 🥳

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.

4 participants