Skip to content

[v10] Refactor character count method to reduce repeated updates#1892

Merged
colinrotherham merged 6 commits into
support/10.xfrom
fix-character-count-repetition
May 7, 2026
Merged

[v10] Refactor character count method to reduce repeated updates#1892
colinrotherham merged 6 commits into
support/10.xfrom
fix-character-count-repetition

Conversation

@colinrotherham
Copy link
Copy Markdown
Contributor

@colinrotherham colinrotherham commented Apr 16, 2026

Description

This PR uplifts alphagov/govuk-frontend#6449 from GOV.UK Frontend v6.0.0 to improve the character count

Our JavaScript API is public by default (we publish types) so I've added 7b8cd78 and d66c040 for compatibility

Credit to @querkmachine for the original changes

Unblocks #1619

Checklist

@colinrotherham colinrotherham added 🐛 bug Something isn't working the way it should (including incorrect wording in documentation) performance character count labels Apr 16, 2026
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 16, 2026 13:18 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from c2f3d2c to a153f0e Compare April 17, 2026 12:32
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 17, 2026 12:32 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from a153f0e to 48d8f00 Compare April 17, 2026 14:44
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 17, 2026 14:44 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from 48d8f00 to a91fa34 Compare April 17, 2026 15:02
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 17, 2026 15:02 Inactive
@colinrotherham colinrotherham changed the title Refactor character count method to reduce repeated updates [v10] Refactor character count method to reduce repeated updates Apr 17, 2026
Base automatically changed from puppeteer-tests to support/10.x April 22, 2026 12:54
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from a91fa34 to 93126fa Compare April 22, 2026 13:46
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 22, 2026 13:46 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from 93126fa to bd0c90d Compare April 27, 2026 08:37
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 27, 2026 08:37 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from bd0c90d to b409382 Compare April 28, 2026 11:07
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 28, 2026 11:07 Inactive
@colinrotherham colinrotherham changed the base branch from support/10.x to component-config-functions April 28, 2026 12:02
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from b409382 to c2c1c8e Compare April 28, 2026 12:03
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 28, 2026 12:03 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from c2c1c8e to 5f27509 Compare April 28, 2026 13:42
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 April 28, 2026 13:43 Inactive
@colinrotherham colinrotherham linked an issue Apr 28, 2026 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@MatMoore MatMoore left a comment

Choose a reason for hiding this comment

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

LGTM, only thing I'm not sure about it is why we need to add deprecated methods in?

this.length = text.length
}

/**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can we remove the deprecated methods again in this PR? Seems like as long as there's a replacement we could update the tests to use that...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can remove them in v11

It's unlikely, but teams might be using them in v10.x so it would be a breaking change

@colinrotherham colinrotherham force-pushed the component-config-functions branch from 3617004 to cdb8624 Compare May 6, 2026 15:47
Base automatically changed from component-config-functions to support/10.x May 6, 2026 16:01
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from 5f27509 to 2d10de4 Compare May 7, 2026 07:22
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 May 7, 2026 07:23 Inactive
@colinrotherham colinrotherham force-pushed the fix-character-count-repetition branch from 2d10de4 to f617fed Compare May 7, 2026 08:15
@colinrotherham colinrotherham temporarily deployed to nhsuk-frontend-pr-1892 May 7, 2026 08:16 Inactive
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 7, 2026

@colinrotherham colinrotherham merged commit d8385a4 into support/10.x May 7, 2026
24 checks passed
@colinrotherham colinrotherham deleted the fix-character-count-repetition branch May 7, 2026 09:20
@github-project-automation github-project-automation Bot moved this from Needs review to Ready to release in Service Manual Sprint Board May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐛 bug Something isn't working the way it should (including incorrect wording in documentation) character count performance

Projects

Status: Ready to release

Development

Successfully merging this pull request may close these issues.

Character count component counts code points, not characters

2 participants