In a discussion titled ‘Sub-categories first in Composer category selector,’ martyn_thomas requested a UI change to display subcategories before their parent categories in Discourse’s Topic Composer, to improve usability. Arkshine provided a CSS solution to reverse the display order and hide the parent category when a subcategory is selected. martyn_thomas appreciated the fix but sought further refinement to show only the subcategory name in the selected dropdown, preserving the parent category only in the dropdown list. After some trial, martyn_thomas confirmed the solution worked in Discourse 3.1 by adjusting the CSS selector to .badge-wrapper instead of .badge-category__wrapper. Arkshine and Jagster confirmed the solution works and praised its logic. Heliosurge suggested conditional CSS based on category names for edge cases, asking where to place it in a component. The thread concluded with a functional, visually cleaner category selector prioritizing subcategories.
Our users select the relevant category in the Topic Composer based on the subcategory - meaning they have to remember the category the subcategory they want to use is under in order to find it.
Is it possible to change how categories are show in the category selector so the sub category and category swap places (with sub category being first) ?
For example - a user wants to post a topic about Governance. Ideally, the Category drop-down shows ‘Governance - Admin’ (and the list is ordered by sub category)
Is there a way for composer to prioritise showing the name of the subcategory over the category in the dropdown once selected or even better, only show the sub category (the categories ‘trail’ only appearing in the dropdown)?
@martyn_thomas I updated my post above. You are on the right track. It misses one rule to restore display when there is no sub-category. (basically, the solution is to hide always the first element and unset the second)
It works for me too (and makes places tidier and more logical, because we are interested in one category, not path to it — parent category is not important here)