Code for the implementation:

TextField

maxLength:

maxLengthEnforcement:

MaxLengthEnforcement

truncateAfterCompositionEnds

// Temporarily lifts the limit.

Be wary of assuming input will not use composing regions

It is tempting when targeting a particular locale to assume
that all users will be satisfied with input from that locale.
For example, forum software targeting an English-language
community might be assumed to only need to deal with English
text. However, this kind of assumption is often incorrect.
For example, maybe the English-language forum participants
will want to discuss Japanese anime or Vietnamese cooking.
Maybe one of the participants is Korean and prefers to express
their name in their native ideographs. For this reason,
freeform fields should rarely use the enforced value
and should instead prefer the
truncateAfterCompositionEnds value if at all possible.

Timeline