์ผ€์ด์Šค ce-0237-chinese-ime-pinyin-table-ios-safari-en-ko ยท ์‹œ๋‚˜๋ฆฌ์˜ค scenario-ime-table-cell-pinyin-safari

IME composition shows Pinyin in table cells on iOS Safari

OS: iOS 16+ ๊ธฐ๊ธฐ: Mobile (iPhone/iPad) Any ๋ธŒ๋ผ์šฐ์ €: Safari 16+ ํ‚ค๋ณด๋“œ: Chinese (IME) - iOS Chinese Input ์ดˆ์•ˆ
compositionimetablechinesepinyiniosmobile

ํ˜„์ƒ

In iOS Safari, when typing Chinese IME text in table cells (<td>), pressing Space to confirm composition causes both raw Pinyin buffer and confirmed Chinese characters to appear together.

์žฌํ˜„ ์˜ˆ์‹œ

  1. Tap on a table cell (<td> element) to focus.
  2. Activate Chinese IME (iOS Chinese keyboard).
  3. Type Pinyin โ€œnihaoโ€ (for Chinese characters โ€œไฝ ๅฅฝโ€).
  4. Press Space to confirm composition.

๊ด€์ฐฐ๋œ ๋™์ž‘

  • Duplicate text: Pinyin โ€œnihaoโ€ and Chinese โ€œไฝ ๅฅฝโ€ appear together โ†’ โ€œnihao ไฝ ๅฅฝโ€
  • Table cells only: Behavior does not occur in paragraph elements (<p>, <div>)
  • iOS Safari specific: Similar to desktop Safari but on mobile devices
  • Works in Chrome/Firefox: Other browsers do not exhibit this bug

์˜ˆ์ƒ ๋™์ž‘

  • Pinyin buffer (โ€œnihaoโ€) should NOT be visible
  • Only confirmed Chinese characters (โ€œไฝ ๅฅฝโ€) should appear

์ฐธ๊ณ ์‚ฌํ•ญ ๋ฐ ๊ฐ€๋Šฅํ•œ ํ•ด๊ฒฐ ๋ฐฉํ–ฅ

  • Use div instead of td: Replace <td> with <div> for editable content when possible
  • Force DOM cleanup: Remove Pinyin text after composition completes
  • Avoid direct editing in table cells: Use modal or overlay for table cell editing
  • Consider non-table structures: Use CSS grid or flexbox instead of HTML tables

์ฝ”๋“œ ์˜ˆ์‹œ

const cell = document.querySelector('td[contenteditable]');
let isComposing = false;

cell.addEventListener('compositionstart', () => {
  isComposing = true;
});

cell.addEventListener('compositionend', () => {
  isComposing = false;
  setTimeout(() => {
    const text = cell.textContent;
    const cleaned = text.replace(/[a-z]+/g, '');
    cell.textContent = cleaned;
  }, 0);
});

cell.addEventListener('keydown', (e) => {
  if (isComposing && e.key === ' ') {
    e.preventDefault();
    // Let IME complete naturally
  }
});

์ด ์‹œ๋‚˜๋ฆฌ์˜ค์˜ ๋ณ€ํ˜•

์ผ€์ด์Šค OS ๋ธŒ๋ผ์šฐ์ € ์ƒํƒœ
ce-0236-chinese-ime-pinyin-table-safari-ko macOS 13+ Safari 17+ ์ดˆ์•ˆ
ce-0237-chinese-ime-pinyin-table-ios-safari-en-ko iOS 16+ Safari 16+ ์ดˆ์•ˆ
ce-0238-ko-chinese-ime-pinyin-table-edge-en-ko Windows 10/11 Edge (Chromium-based) 120+ ํ™•์ธ๋จ
ce-0239-chinese-ime-pinyin-table-firefox-en-ko macOS 13+ Firefox 120+ ํ™•์ธ๋จ

Playground for this case

Use the reported environment as a reference and record what happens in your environment while interacting with the editable area.

Reported environment
OS: iOS 16+
Device: Mobile (iPhone/iPad) Any
Browser: Safari 16+
Keyboard: Chinese (IME) - iOS Chinese Input
Your environment
Sample HTML:
Event log
Use this log together with the case description when filing or updating an issue.
0 events
Interact with the editable area to see events here.