fix: 修复评论区回复按钮第一次点击无效的问题

- 为 .comment-operations 添加 pointer-events: none(opacity: 0 时)
- hover 时恢复 pointer-events: auto
- 问题原因:按钮不可见时仍能接收点击事件,导致第一次点击被'空'按钮捕获
- 恢复 jQuery 事件委托方式绑定回复按钮点击事件
This commit is contained in:
2026-01-16 21:03:07 +08:00
parent 2da70526ea
commit 8f3f80d2df
2 changed files with 4 additions and 8 deletions

View File

@@ -1017,15 +1017,9 @@ if (argonConfig.waterflow_columns != "1") {
$("#post_comment").removeClass("post-comment-force-privatemode-on post-comment-force-privatemode-off");
}
// 使用原生事件委托确保第一次点击也能响应
document.addEventListener('click', function(e) {
let target = e.target.closest('.comment-reply');
if (target) {
reply(target.getAttribute('data-id'));
}
$(document).on("click" , ".comment-reply" , function(){
reply(this.getAttribute("data-id"));
});
// 保留 jQuery 事件绑定用于 PJAX 兼容
$(document).on("click pjax:click" , "#post_comment_reply_cancel" , function(){
cancelReply();
});

View File

@@ -5322,11 +5322,13 @@ html.darkmode .comment-item-avatar .avatar {
background: var(--color-widgets);
border-radius: var(--m3-shape-sm, 6px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
pointer-events: none;
}
.comment-item:hover .comment-operations {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
html.darkmode .comment-operations {