fix(webchat): skip textarea resize during IME composition to eliminat… · openclaw/openclaw@8432d7d
joelnishanth
·
2026-06-17
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1839,6 +1839,33 @@ describe("chat composer IME composition", () => {
|
1839 | 1839 | expect(onSend).not.toHaveBeenCalled(); |
1840 | 1840 | expect(onHistoryKeydown).not.toHaveBeenCalled(); |
1841 | 1841 | }); |
| 1842 | + |
| 1843 | +it("does not force textarea resize during IME composition", () => { |
| 1844 | +const container = renderChatView({}); |
| 1845 | +const textarea = requireElement( |
| 1846 | +container, |
| 1847 | +".agent-chat__composer-combobox > textarea", |
| 1848 | +"composer textarea", |
| 1849 | +) as HTMLTextAreaElement; |
| 1850 | + |
| 1851 | +// Set a sentinel height to detect unwanted overwrites |
| 1852 | +textarea.style.height = "42px"; |
| 1853 | + |
| 1854 | +textarea.dispatchEvent(new CompositionEvent("compositionstart", { bubbles: true })); |
| 1855 | +textarea.value = "shi"; |
| 1856 | +textarea.dispatchEvent(new InputEvent("input", { bubbles: true, isComposing: true })); |
| 1857 | +textarea.value = "shichang"; |
| 1858 | +textarea.dispatchEvent(new InputEvent("input", { bubbles: true, isComposing: true })); |
| 1859 | + |
| 1860 | +// Height must stay untouched — no forced reflow during composition |
| 1861 | +expect(textarea.style.height).toBe("42px"); |
| 1862 | + |
| 1863 | +textarea.value = "市场"; |
| 1864 | +textarea.dispatchEvent(new CompositionEvent("compositionend", { bubbles: true })); |
| 1865 | + |
| 1866 | +// After composition ends, adjustTextareaHeight runs via syncComposerValue |
| 1867 | +expect(textarea.style.height).not.toBe("42px"); |
| 1868 | +}); |
1842 | 1869 | }); |
1843 | 1870 | |
1844 | 1871 | describe("chat slash menu accessibility", () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。