[Webkit-unassigned] [Bug 229553] New: input "maxlength" attribute counts grapheme clusters rather than code units

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Aug 26 06:23:20 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=229553

            Bug ID: 229553
           Summary: input "maxlength" attribute counts grapheme clusters
                    rather than code units
           Product: WebKit
           Version: Safari Technology Preview
          Hardware: Unspecified
                OS: macOS 11
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Forms
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: baba at bpsinc.jp
                CC: cdumez at apple.com, wenson_hsieh at apple.com

Created attachment 436503

  --> https://bugs.webkit.org/attachment.cgi?id=436503&action=review

screenshot

Steps to reproduce:
1. Open https://jsbin.com/pujuyizuze/1/edit?html,output
2. Enter "��‍��‍��".
  * Note: This is a character of one grapheme cluster, but has five Unicode code points (Man/ZWJ/Man/ZWJ/Boy). The "length" of this character is "8".

Expected behavior:
Just "��‍" is pasted, then no more characters can be added.

Actual behavior:
Entire "��‍��‍��" is pasted. Furthermore, totally three "��‍��‍��" character can be input.

As the spec described, "maxlength" must address the "length", in other words "16-bit integers". Using grapheme cluster is incorrect.

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#attr-fe-maxlength
> The "number of characters" is measured using length

https://infra.spec.whatwg.org/#string-length
> A string’s length is the number of code units it contains.

Other browsers such as Chrome, Firefox and Edge work correct.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210826/91effa1d/attachment-0001.htm>


More information about the webkit-unassigned mailing list