fix: 修复评论区回复按钮第一次点击无效的问题
- 为 .comment-operations 添加 pointer-events: none(opacity: 0 时) - hover 时恢复 pointer-events: auto - 问题原因:按钮不可见时仍能接收点击事件,导致第一次点击被'空'按钮捕获 - 恢复 jQuery 事件委托方式绑定回复按钮点击事件
This commit is contained in:
@@ -1017,15 +1017,9 @@ if (argonConfig.waterflow_columns != "1") {
|
|||||||
$("#post_comment").removeClass("post-comment-force-privatemode-on post-comment-force-privatemode-off");
|
$("#post_comment").removeClass("post-comment-force-privatemode-on post-comment-force-privatemode-off");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 使用原生事件委托确保第一次点击也能响应
|
$(document).on("click" , ".comment-reply" , function(){
|
||||||
document.addEventListener('click', function(e) {
|
reply(this.getAttribute("data-id"));
|
||||||
let target = e.target.closest('.comment-reply');
|
|
||||||
if (target) {
|
|
||||||
reply(target.getAttribute('data-id'));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// 保留 jQuery 事件绑定用于 PJAX 兼容
|
|
||||||
$(document).on("click pjax:click" , "#post_comment_reply_cancel" , function(){
|
$(document).on("click pjax:click" , "#post_comment_reply_cancel" , function(){
|
||||||
cancelReply();
|
cancelReply();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -5322,11 +5322,13 @@ html.darkmode .comment-item-avatar .avatar {
|
|||||||
background: var(--color-widgets);
|
background: var(--color-widgets);
|
||||||
border-radius: var(--m3-shape-sm, 6px);
|
border-radius: var(--m3-shape-sm, 6px);
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comment-item:hover .comment-operations {
|
.comment-item:hover .comment-operations {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
html.darkmode .comment-operations {
|
html.darkmode .comment-operations {
|
||||||
|
|||||||
Reference in New Issue
Block a user