Skip to content

fix(dialog): stabilize input placeholder layer during enter transition - #4722

Open
lnuxe wants to merge 1 commit into
Tencent:developfrom
lnuxe:fix/dialog-input-placeholder-offset
Open

lnuxe wants to merge 1 commit into
Tencent:developfrom
lnuxe:fix/dialog-input-placeholder-offset

Conversation

@lnuxe

@lnuxe lnuxe commented Nov 13, 2026

Copy link
Copy Markdown

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

Closes #4551

💡 需求背景和解决方案

问题:打开输入类对话框时(官方示例小程序「输入类-无描述/带描述」即可复现),弹窗进场动画期间 t-input 内的文字/placeholder 出现竖向偏移,动画结束后部分机型不恢复。

根因:t-popup 的 center 进场动画让对话框容器持续处于 scale(0.6) translate3d(-50%,-50%) → scale(1) translate3d(...) 的合成层变换中。原生 input 节点的 placeholder 在该中间态下完成首次布局,布局结果被变换中间态污染,产生竖向漂移;动画结束后部分渲染内核不重排。

修复:在 dialog.less 中把 __content 与内部 t-input 提升为独立合成层(transform: translateZ(0); backface-visibility: hidden),切断外层动画变换对 input 首次布局的干扰,placeholder 直接按最终几何布局。

验证:

  • 单测全量:pnpm test:unit 146 suites / 873 tests / 403 snapshots 全绿(与 develop 基线一致)
  • prettier --check 通过
  • 视觉验证建议:微信开发者工具打开示例小程序 Dialog 页「输入类」demo,真机重点回归 iOS(原报告机型)

📝 更新日志

  • fix(dialog): 修复弹窗进场动画期间输入框 placeholder 竖向偏移的问题

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项。⚠️

  • 标题遵循 Conventional Commits 格式
  • 相关 Issue 已关联
  • 无需更新组件文档(纯样式修复,无 API 变化)
  • 已通过仓库全部单元测试

The popup enter animation keeps the dialog container inside a scale/translate composited layer. Native input placeholders complete their first layout against that intermediate transform state and end up vertically offset (issue Tencent#4551). Promote the dialog content and nested input to their own composited layer so the placeholder layout is computed from the settled geometry.
@lnuxe
lnuxe force-pushed the fix/dialog-input-placeholder-offset branch from fe8db3a to 89140c2 Compare November 23, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[组件名称] t-dialog中的t-input,打开dialog时,input中的文字会有个位置偏移

1 participant