fix(comments): open the action dropdown with theme-owned delegation

The comment three-dot menu relied on the legacy data-toggle=dropdown
delegation living in comment-move-form.js; when that bundle chain does
not evaluate (stale cache or an earlier top-level error), the menu
appears dead. Move the comment action dropdown to its own top-level
document delegation in comments.js (data-aksrt-comment-drop), keep the
.open-driven CSS contract including the mobile drop-fixed-sm sheet,
sync aria-expanded, close on outside click / Escape / menu item click,
and stay idempotent for AJAX-injected comments.
This commit is contained in:
kate522 committed 2026-09-20 13:55:03 +08:00
1 parent 7c730b83d6
commit 913958820c
3 files changed
+54 -2

No files matched your search

+4 -1
View File
@@ -224,7 +224,10 @@ if (!function_exists('aksrt_get_comments_action_dropdown_html')) :
}
$menu_icon = function_exists('aksrt_get_comment_icon') ? aksrt_get_comment_icon('menu_2') : '';
$icon_a = '<a href="javascript:;" class="muted-color padding-6" data-toggle="dropdown">' . $menu_icon . '</a>';
// 交互由主题自有 comments.js 委托处理(data-aksrt-comment-drop),
// 不用 vendor 的 data-toggle="dropdown" 遗留委托:该链路在部分环境
// 未注册/被早退,导致三点菜单点不开。open 类驱动的 CSS 契约不变。
$icon_a = '<a href="javascript:;" class="muted-color padding-6" data-aksrt-comment-drop aria-haspopup="true" aria-expanded="false" aria-label="' . esc_attr__('更多操作', 'aksrt') . '">' . $menu_icon . '</a>';
return '<span class="dropdown drop-fixed-sm padding-6">' . $icon_a . '<ul class="dropdown-menu">' . $lists . '</ul></span>';
}