Skip to content

Commit e605484

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

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

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

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

134-
if (this.config.countType === 'characters' || !!this.config.countFunction) {
134+
if (
135+
this.config.countType === 'characters' ||
136+
(this.config.countType === 'words' &&
137+
this.config.maxwords === undefined) ||
138+
!!this.config.countFunction
139+
) {
135140
if (!('Segmenter' in Intl)) {
136141
throw new SupportError(
137142
formatErrorMessage(

0 commit comments

Comments
 (0)