One thing you can try is to make the entire container clickable.
If you click on a subcategory, you get taken to it. If you click anywhere else inside the category container, you get taken to the parent category’s page.
This goes in the common > header tab.
<script type="text/discourse-plugin" version="0.8">
const DiscourseURL = require("discourse/lib/url").default;
api.modifyClass("component:categories-and-latest-topics", {
pluginId: "clickable-category-boxes",
click(event) {
const target = event.target;
const categoryContainer = target.closest("[data-category-id]");
if (!categoryContainer) {
return;
}
const isSubcategoryLink = target.closest(".badge-wrapper");
if (isSubcategoryLink) {
return;
}
const categoryLink = categoryContainer.querySelector(
".category-title-link"
);
const categoryURL = categoryLink.href;
DiscourseURL.routeTo(categoryURL);
},
});
</script>
This goes in the common > CSS tab.
.category-list [data-category-id] {
cursor: pointer;
}