fix: 修复了嵌套 Dropdown 点击子菜单项时,父级菜单会意外关闭导致点击事件丢失的问题#3119
Open
xshuxin wants to merge 2 commits intoDouyinFE:mainfrom
Open
fix: 修复了嵌套 Dropdown 点击子菜单项时,父级菜单会意外关闭导致点击事件丢失的问题#3119xshuxin wants to merge 2 commits intoDouyinFE:mainfrom
xshuxin wants to merge 2 commits intoDouyinFE:mainfrom
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 919cb48:
|
Collaborator
|
这会改变现在的行为,更推荐添加一个开关来开关这个PR的逻辑来保证兼容性 |
Author
刚刚重新验证了一下,发现是自己用法错误导致出现该问题,错误使用了content,然而实际上 content 会直接透传到 tooltip ,Dropdown 本身用 render 生成了带 Context 的内容,传 content 会覆盖它,导致嵌套相关的处理失效,换回 render 就正常了。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR description
在排查嵌套 Dropdown 问题时,发现如果错误地向 Dropdown 传递了 content 属性(通常是 Tooltip 的用法),该属性会通过 ...attr 透传给底层的 Tooltip,从而覆盖掉 Dropdown 内部生成的 pop 内容(包含 Context 和嵌套逻辑)。这会导致嵌套菜单的交互失效(如点击子菜单导致父级意外关闭)。
此 PR 调整了 Dropdown 中 Tooltip 组件的属性顺序,确保内部生成的 content={pop} 始终位于 ...attr 之后,即使开发者错误使用了 content 属性,Dropdown 也能保持内部逻辑的正确性,提高组件的健壮性。
修复方案:
Fixes [BUG] [Dropdown] 嵌套 Dropdown 点击子菜单触发父级 onClickOutSide,导致子菜单 onClick 事件丢失 #3118
🇨🇳 Chinese