-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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(components): [collapse] allow nested inputs in ElCollapseItem to … #14061
Conversation
👋 @kinggq, seems like this is your first time contribution to element-plus.
|
🧪 Playground Preview: https://element-plus.run/?pr=14061 |
The issue doesn't seem to be resolved. example |
the |
I don't think this issue needs to be solved, it's not a correct usage. |
Co-authored-by: btea <2356281422@qq.com>
It seems that the modifications you made can indeed solve this problem |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
…ement-plus#14061) * fix(components): [collapse] allow nested inputs in ElCollapseItem to handle space key * Update packages/components/collapse/src/collapse-item.vue Co-authored-by: btea <2356281422@qq.com> --------- Co-authored-by: btea <2356281422@qq.com>
直接在input上面添加@keydown.space.stop @keyup.space.prevent这个阻止默认事件即可. |
…handle space key
Please make sure these boxes are checked before submitting your PR, thank you!
dev
branch.Description
This PR addresses an issue in the ElCollapseItem component where nested input elements within the component were unable to recognize and handle space key inputs due to a parent div capturing and preventing the event. The event handling logic has been updated to ensure that nested inputs can function as expected while still maintaining the desired behavior on the parent div. #14027
Related Issue
Fixes #14027
Explanation of Changes
Updated event handling logic on the parent div of ElCollapseItem by using .stop.prevent.self modifiers for the keypress.space.enter event. This ensures the event is only prevented when the event target is the div itself and not any child elements.
This change allows nested inputs to properly handle space key inputs while still maintaining the desired expand/collapse behavior on the parent div.