Web 输入框无法正常使用中文输入法预编辑文字 #1417
galaxyboyleo
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Web 输入框无法正常使用中文输入法预编辑文字
问题
在 DSH Web composer 中使用微信输入法拼音模式时,无法正常输入中文;同一输入法在其他网页、应用和终端中工作正常。
复现环境
0.1.0-rc.647f943859bef60e4160492346772ded9b24f765a26.5.1 (25F80)151.0.7922.138com.tencent.inputmethod.wetype.pinyindsh web复现步骤
dsh web,打开任意会话。实际结果:中文预编辑文字无法正常显示或输入。
预期结果:拼音预编辑文字和候选词选择过程正常可见,选词后中文完整保留在草稿中。
初步定位
InputBar.module.css中真实textarea使用color: transparent,可见文字由其下方的[data-input-backdrop]镜像层绘制:InputBar.module.css#L202-L218InputBar.tsx#L689-L729现有
compositionstart/compositionend只维护按键保护用的composingRef,没有处理原生预编辑文字的可见性:InputBar.tsx#L104-L119CJK IME 的 preedit 文字由浏览器在原生输入控件中绘制;不同输入法/浏览器组合不保证在 composition 期间持续用普通
input更新 React 镜像。因此真实 textarea 透明时,预编辑文字可能完全不可见。已验证的本地 workaround
我用一个独立 Web client 插件验证了以下最小处理:
compositionstart时给 composer textarea 添加临时属性;[data-input-backdrop],避免重复文字;compositionend后在下一个 task 恢复原有透明 textarea + backdrop;blur和插件卸载时清理临时状态。核心 CSS:
浏览器组合事件验证结果:
建议验收
zhongwen并选择“中文”,草稿正确显示“中文”;input-bar.client.spec.tsx增加 composition 可见状态的回归测试,并保留现有 Safari 延迟清除按键保护。All reactions