Skip to content

Commit 4848496

Browse files
Expose segmenter for countType: "words"
Unless the (deprecated) `maxwords` option is used
1 parent d014d6d commit 4848496

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/govuk-frontend/src/govuk/components/character-count/character-count.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ export class CharacterCount extends ConfigurableComponent {
131131
locale: closestAttributeValue(this.$root, 'lang')
132132
})
133133

134-
if (this.config.countType === 'characters') {
134+
if (
135+
this.config.countType === 'characters' ||
136+
(this.config.countType === 'words' && this.config.maxwords === undefined)
137+
) {
135138
if (!('Segmenter' in Intl)) {
136139
throw new SupportError(
137140
formatErrorMessage(

0 commit comments

Comments
 (0)