When I enter CJK in iOS safari, the following error occurs.
Mozilla/5.0 (iPhone; CPU iPhone OS 15_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.4 Mobile/15E148 Safari/604.1
IndexSizeError: The index is not in the allowed range.
I think it occurs at the timing when the composition end ignites.
I was able to reproduce the error in the demo on the top page of the site.
(It happens in demos on every page.)
Share the log output to console.
IndexSizeError: The index is not in the allowed range.
setEnd
textRange — codemirror.js:3737
textCoords — codemirror.js:4336
coordsInChildren — codemirror.js:4658
coordsAtPos — codemirror.js:9952
addSpan — codemirror.js:10472
drawForLine — codemirror.js:10495
measureRange — codemirror.js:10447
map
readPos — codemirror.js:10338
readPos
(anonymous関数) — codemirror.js:9718
map
measure — codemirror.js:9716
When I investigated the contents of the argument passed to “textRange”, an empty string may be passed, and an error occurred at that time.
console.log(text, from, to);
// text: ""
// from: 0
// to: 1
let rects = textRange(text, from, to).getClientRects();