If you drag an emoji family with a string size of 11 into an input with maxlength=10, one of the children will disappear.

Except in Safari, whose maxlength implementation seems to treat all emoji as length 1. This means that the maxlength attribute is not fully interoperable between browsers.

I filed a WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=252900

252900 – HTML maxlength attribute treats emoji of string length 11 as length 1

@simevidas dang not unicode aware :')
@jkt @simevidas In this case, Safari is the one that’s Unicode aware. The other browsers are treating maxlength as the number of bytes rather than the number of characters. 🙂

@ramsey @jkt @simevidas Safari may be Unicode-aware, but is it HTML-aware? The specification is clear on this point: "A string’s length is the number of code units it contains."

See https://infra.spec.whatwg.org/#string-length

Infra Standard