Header Categories Navbar

This is a simple component that adds a menu of parent category links to the site header, with horizontally scrolling overflow added if/when needed.

19 Likes

This is really cool - I love it, Kris! It will combine with the sidebar beautifully, allowing the core cats up top and a short personalised selection on the bar.

Iā€™ve noticed two little UX issues that could really give it a lift if addressed:

UX: Category selection highlight

When on a category list, the correct category has a lovely subtle underline.

However, this doesnā€™t persist if a Topic or a subcategory is entered.

It would be lovely if it did persist in both of those situations.

UX: scroll / overflow on mobile

There is a nice little fade / subtle arrow visible when there is overflow of the categories on desktop.

Overflow is much more likely on mobile, but on my device (Chrome / Android) these subtle cues are not present - and it isnā€™t clear that scrolling is possible.

It might also help to have the categories bar a little taller on mobile to make scrolling easier.

6 Likes

Another couple of UX issues on mostly applying to mobile:

Mobile topic breadcrumb clash

In mobile topic views, the breadcrumb navigation clashes with the categories navbar:

Highlighted category not in view

Also, the category selected isnā€™t scrolled to automatically - this means that it is not apparent that it is selected unless the user scrolls the Navbar. This is vital really.

Desktop only?

I do wonder if it isnā€™t really ready for mobile yet, and it would be really handy to have a setting to only apply it to desktop (at least for now).

4 Likes

Thanks for the quick feedback! Iā€™ve merged in some updates that should address these.

3 Likes

Brilliant - very happy to give feedback when it is listened to! Youā€™ve had to make quite a few additions to it I note.

Iā€™ll take that as a nice little Christmas :gift: to one another :heart_eyes:.

Youā€™ve fixed this when a Subcategory has been entered - wonderful!

However, it does not apply when a topic is entered - is that deliberate? Personally, I believe that it would make sense if the category stays highlighted while the user is ā€˜inā€™ it, which includes the topics and not just the category discovery views.

Also, when I enter another page (such as /admin) the category remains selected. It would be better if no category was selected in this case.

I can see the fade on mobile now, but not an arrow / chevron. If possible this would be super helpful as the fade is pretty damn subtle:

Desktop: image

Mobile: image

Request #1 - UX

Hide the Navbar when scrolling in a topic. It all gets a bit busy!

Also, it might be better on desktop to have the Navbar located where the breadcrumb / tags are in that image instead of below them.

Request #2 - Feature

Could you please add a CSS class to each Nav Pill so it would be easy to hide some if needed?

I ask because I have a couple of (private) parent categories which are only parents in order to enable subcategories, and they clutter up the general navigation in an undesirable way.

Iā€™ve hidden these for now using their href, but that is of course pretty dicey!

Request #3 - UX

An option to sort Sidebar Categories alphabetically.

As Iā€™m implementing this, Iā€™ve removed the parent categories from the default sidebar categories list. This means that my users now have just a list of 1-5 subcategories that are relevant to them.

However, they are a bit scrambled and in no logical order as the order on /Categories for subs doesnā€™t really make sense . It would be very helpful for these subcats to be alphabetic to help this!!

4 Likes

Colors are bit off when selected

  • default light and dark palettes

Ideas?

3 Likes

Thanks for reporting! this should fix it:

2 Likes

Works perfectly. Thanks!

2 Likes

Hello! First of all, I would like to note that this is a very useful component of the topic and I want to thank you for the work you have done :raised_hands:
On my instance, this component caused an error, I checked for compatibility with other plugins and theme components and at this point I have not yet found a conflict. Could the component itself be the cause?

Enabling this component distorts the presentation of the content.
Hereā€™s a video:


In order to detect an error, you need to click on any post from the latest posts page /latest, the post will open in standard mode, then you need to go back to the latest posts page.

1 Like

@Aizada_M - I canā€™t seem to reproduce this. Is this happening to you when you preview from the component?

2 Likes

Greetings! Sorry for the long response :raised_hands:
I didnā€™t use the preview, I tested it with the component enabled.

1 Like

This works 100% of the time when I click on the category name under the topic title.

1 Like

Iā€™ve noticed that the text in the Head Categories Navbar suddenly changed to font-up-1 (whereas I think it was font-down-1 before). This is quite jarring and unpleasant, as it is the same as all the other nav pills.

Iā€™ve over-ridden it with this CSS, which is much more pleasing:

// fixes text size of header navbar
.custom-categories-navbar .nav-pills>li>a {
    font-size: var(--font-0);
}

I prefer font-0 actually as it is different enough and a bit easier to use.

1 Like

The core CSS did not change, and the component does not set the font size. :thinking:
Maybe you had custom CSS before?

2 Likes

4 posts were split to a new topic: Broken mobile styling of Header Categories Navbar

Love this TC, thank you! Would be great to customize which items do and do not appear!

3 Likes

I love it but the theme component seems broken in the latest version of discourse

EDIT: itā€™s works fine, but needed to desactive ā€œchatā€ and ā€œDark-Light Toggleā€ icons in the header

2 Likes

It works for me with chat active :slight_smile:

3 Likes

yes itā€™s because of my logo. If i cut it a little bit, its works with chat and dark-light toggle. I"m using:

.d-header #site-logo {
max-height: 30px;
}

for now

2 Likes

Hey, i just saw a bug now, you can reproduce like that. On mobile:

1- Click on one category in the header
2 - Click on one post in the category and Scroll at the end
3 - Click on the same category on the header

All the category header will disappear. I just tryed it on my forum and on the demo

EDIT:

itā€™s the same if you go to a category and refresh( f5) the page. All category will disappear.

EDIT:

Is there any fix for it? Thanks

2 Likes