Skip to content

Fix inconsistent sidebar toolbar button order when navigating to Browse page#283

Merged
rvanmaanen merged 3 commits intomainfrom
copilot/fix-sidebar-button-order
Mar 21, 2026
Merged

Fix inconsistent sidebar toolbar button order when navigating to Browse page#283
rvanmaanen merged 3 commits intomainfrom
copilot/fix-sidebar-button-order

Conversation

Copy link
Contributor

Copilot AI commented Mar 20, 2026

The "Content" filter toolbar button appeared in different positions depending on navigation history: first when loading /all fresh, but last when navigating from a collection page (e.g. /all/videos) to /all/all within the same SPA session.

Root cause

MobileSidebarPanel registers itself with MobileSidebarToolbar in OnInitialized, which appends to _panels. The "Content" panel is conditional (@if (ShowContentTypeFilter)), so when navigating from a non-Browse page (panel absent) to Browse (panel should be first), it registers after Search/Date/Tags — ending up rightmost instead of leftmost.

Fix

Added @key="@ShowContentTypeFilter" to MobileSidebarToolbar in SectionCollection.razor. When ShowContentTypeFilter changes, Blazor destroys and recreates the toolbar, causing all panels to re-register in template declaration order.

<MobileSidebarToolbar @key="@ShowContentTypeFilter">
    @if (ShowContentTypeFilter)
    {
        <MobileSidebarPanel Label="Content" Icon="filter" ...>
        ...
    }
    <MobileSidebarPanel Label="Search" ...>
    <MobileSidebarPanel Label="Date" ...>
    <MobileSidebarPanel Label="Tags" ...>
</MobileSidebarToolbar>

Changes

  • SectionCollection.razor — add @key="@ShowContentTypeFilter" to MobileSidebarToolbar
  • SectionCollectionTests.cs — regression tests: fresh Browse render has Content first; navigating collection → Browse keeps Content first
  • docs/page-structure.md — document the conditional "Content / filter" panel in the SectionCollection panel table
Original prompt

This section details on the original issue you should resolve

<issue_title>Order of sidebar buttons inconsistent on mobile</issue_title>
<issue_description>Maybe also on desktop. When I go to /all the content filter button is the most left one in the toolbar on my mobile, but when I go to /all/all then it's all the way on the right</issue_description>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

…Collection

Co-authored-by: rvanmaanen <4835258+rvanmaanen@users.noreply.github.com>
Agent-Logs-Url: https://github.com/techhubms/techhub/sessions/16b3d056-1d89-4921-b658-266784ca00d1
Copilot AI changed the title [WIP] Fix inconsistent order of sidebar buttons on mobile Fix inconsistent sidebar toolbar button order when navigating to Browse page Mar 20, 2026
Copilot AI requested a review from rvanmaanen March 20, 2026 22:22
@github-actions
Copy link
Contributor

github-actions bot commented Mar 20, 2026

✅ PR Preview Environment Removed

The preview environment for this pull request has been removed.

@rvanmaanen rvanmaanen marked this pull request as ready for review March 21, 2026 08:37
@rvanmaanen rvanmaanen requested a review from rajbos as a code owner March 21, 2026 08:37
@rvanmaanen rvanmaanen merged commit 675a53e into main Mar 21, 2026
22 checks passed
@rvanmaanen rvanmaanen deleted the copilot/fix-sidebar-button-order branch March 21, 2026 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Order of sidebar buttons inconsistent on mobile

2 participants