Preserve the state of character count when navigating 'back' #1868
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1848
What
When the user navigates back to a previous page that includes a character count, the character count message should reflect the text currently in the textarea.
Why
Fix based on #1842
Previously, when navigating back to a page with a character count, the character count message wouldn't update (reflect the text currently in the textarea) until the textarea received focus.
Current behaviour: http://govuk-frontend-review.herokuapp.com/full-page-examples/feedback
Preview new behaviour: https://govuk-frontend-review-pr-1868.herokuapp.com/full-page-examples/feedback
Notes
On slow connections there may be a flash of the default character count text before it updates. From testing with a 4x CPU slowdown, the default text may show for 0.03s before it updates. Given how small this is even with slowdown, we've decided to leave it as-is. If we decide this is an issue in the future, we'd also need to look at other components (e.g: radios and checkboxes) which are affected in a similar way.
Browser testing