Index button on smaller screens

AI-generated summary

The discussion revolves around the visibility of the index button on smaller screens in Discourse, specifically when topics have fewer than two replies. MarcP notes that while the index button appears dynamically at the bottom for topics with one or more replies, it doesn’t show up for topics with zero replies — even though such topics may still benefit from a table of contents. He questions whether this is a bug or intentional behavior. Sam Saffron suggests this might be an intentional omission, particularly for documentation categories where replying is often restricted, though MarcP points out that replying can already be controlled via permissions or topic closure. awesomerobot clarifies that this behavior occurs in narrow desktop views (not mobile) and traces the logic to a code condition that hides the progress bar (and thus the index) when there are fewer than two replies and the view is not mobile. They note that mobile views don’t have this restriction and propose removing the desktop restriction to ensure consistent TOC availability regardless of reply count. The issue touches on UX consistency for documentation-style topics and whether the current behavior serves its intended purpose.

If there is no space the index is hidden by default.

In this case, a dynamic bar shows up at the bottom with an index button. Like here.

The above only happens if there is 1 replies or more. Most of my docs have zero replies, like here - in this case the same index button does not show up.

Not sure if this is a bug, or should be a feature :stuck_out_tongue:

3 Likes

@awesomerobot I think we we recently refactored this, is this an on-purpose omission?

I totally get that documentation categories may want this (and to restrict replying)

3 Likes

Unless I misunderstand this can already be prevented with permissions or closing topics :thinking:

2 Likes

Hmm I see, this is narrow views in desktop view, not mobile view, right?

It seems by default we hide the topic progress bar on desktop with < 2 replies, so because of this the table of contents can’t appear.

Curiously, we don’t do this on mobile… so maybe we should remove it.

const hideOnShortStream = !this.site.mobileView && filteredPostsCount < 2;
2 Likes