Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(selectinput): 修复某些场景下select-input 无法输入的问题 #1760

Merged
merged 2 commits into from
Nov 30, 2022

Conversation

HelKyle
Copy link
Contributor

@HelKyle HelKyle commented Nov 29, 2022

修复 #1750 ,排查下来问题的过程大概是这样:

  1. 用户修改 input 内容,触发 input 事件
  2. bitwarden 插件监听到 input 事件(捕获),同步修改 dom 属性
  3. popup 监听到 mutation,执行 popper 的 update 方法
  4. popper update 方法会调用 flushSync方法,强制更新一次视图
  5. input 内容被刷掉,出现无法输入的问题

想了一下,Popup 同步的优先级没有那么高,加一个 setTimeout 来解决这个问题。

🤔 这个 PR 的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

📝 更新日志

  • fix(组件名称): 处理问题或特性描述 ...

  • 本条 PR 不需要纳入 Changelog

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

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

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

@github-actions
Copy link
Contributor

github-actions bot commented Nov 29, 2022

完成

@honkinglin
Copy link
Collaborator

honkinglin commented Nov 30, 2022

setTimeout 方案也可以,但是要控制下 timer 并及时清除,MutationObserver 是微任务,setTimeout 是宏任务,加上 MutationObserver 触发频率其实很高,过多的往队列推送宏任务担心引发其他问题

src/popup/Popup.tsx Outdated Show resolved Hide resolved
@honkinglin honkinglin merged commit 92b84b6 into Tencent:develop Nov 30, 2022
@github-actions github-actions bot mentioned this pull request Nov 30, 2022
16 tasks
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.

2 participants