frontend: add non-clickable section headers to the sidebar - #6108
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Soli0222 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
illume
left a comment
There was a problem hiding this comment.
Thanks for these changes.
Can you please have a look at the git commits to see if they meet the contribution guidelines? We use a Linux kernel style of git commits. See the contributing guide for general context, and please see previous git commits with git log for examples.
Commits that need attention
frontend: add non-clickable section headers to the sidebar— Description must start with a capital letter — e.g.frontend: HomeButton: Fix the buttonnotfrontend: HomeButton: fix the button.frontend: fix sidebar section header contrast— Description must start with a capital letter — e.g.frontend: HomeButton: Fix the buttonnotfrontend: HomeButton: fix the button.
Commit guidelines
- Use atomic commits focused on a single change.
- Use the title format
<area>: <Description of changes>— description must start with a capital letter. - Keep the title under 72 characters (soft requirement).
- Explain the intention and why the change is needed.
- Make commit titles meaningful and describe what changed.
- Do not add code that a later commit rewrites; squash or reorder commits instead.
- Do not include
Fixes #NNin commit messages.
Good examples:
frontend: HomeButton: Fix so it navigates to homebackend: config: Add enable-dynamic-clusters flag
There was a problem hiding this comment.
Pull request overview
Adds a new entryType: 'subheader' option for plugin-registered sidebar entries so plugins can insert non-clickable section headers (rendered as ListSubheader when expanded and as a Divider when collapsed), while keeping existing sidebar entries working as normal link items.
Changes:
- Extends sidebar entry data passed through
registerSidebarEntryto includeentryTypeand optionalsxoverrides. - Updates
SidebarItemrendering logic to support non-clickable subheader entries and a collapsed-state divider. - Adds unit tests and Storybook stories/snapshots covering subheader rendering, collapsed behavior, hidden entries, and style overrides.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| plugins/examples/sidebar/src/index.tsx | Updates the sidebar example plugin to register a section header via entryType: 'subheader' and custom sx. |
| frontend/src/plugin/registry.tsx | Passes entryType and sx through registerSidebarEntry into the sidebar slice. |
| frontend/src/components/Sidebar/useSidebarItems.test.tsx | Adds coverage to ensure custom sidebar entries include entryType/sx fields. |
| frontend/src/components/Sidebar/sidebarSlice.ts | Extends SidebarEntry with entryType/sx and updates reducer typing for stored entries. |
| frontend/src/components/Sidebar/SidebarItem.tsx | Implements rendering for entryType: 'subheader' (expanded subheader vs collapsed divider). |
| frontend/src/components/Sidebar/SidebarItem.test.tsx | Adds unit tests for subheader rendering, collapsed behavior, hidden entries, and sx overrides. |
| frontend/src/components/Sidebar/Sidebaritem.stories.tsx | Adds Storybook stories for default/collapsed/styled section headers. |
| frontend/src/components/Sidebar/snapshots/Sidebaritem.SectionHeader.stories.storyshot | New storyshot snapshot for SectionHeader. |
| frontend/src/components/Sidebar/snapshots/Sidebaritem.CollapsedSectionHeader.stories.storyshot | New storyshot snapshot for CollapsedSectionHeader. |
| frontend/src/components/Sidebar/snapshots/Sidebaritem.StyledSectionHeader.stories.storyshot | New storyshot snapshot for StyledSectionHeader. |
|
Thanks for the reviews. I updated the commit subjects to match the contribution guidelines, rebased the branch onto the latest upstream/main, and addressed both Copilot comments. Changes since the previous push:
Validation:
|
|
@illume I addressed the latest Copilot follow-up about the subheader child link styling. Validation:
Since this PR does not currently show a pending review request for you, mentioning you here. Could you take another look when you have a chance? |
illume
left a comment
There was a problem hiding this comment.
Thanks for this PR.
The open review comments from Copilot still need attention — can you have a look? Once addressed, please mark them as resolved.
|
@illume Thanks for the reminder. The Copilot comments had already been addressed in the latest code, but I had missed marking the review threads as resolved. I have now marked those threads as resolved. Validation from the latest update:
|
illume
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
There are some open Copilot review comments — could you take a look at them? Please mark each one as resolved once you've addressed it.
|
@illume Thanks for the reminder. The Copilot comments had already been addressed in the latest code, but I had missed marking the review threads as resolved. I have now marked those threads as resolved. |
illume
left a comment
There was a problem hiding this comment.
Thanks for these changes.
Can you please have a look at the git commits to see if they meet the contribution guidelines? We use a Linux kernel style of git commits. See the contributing guide for general context, and please see previous git commits with git log for examples.
Commits that need attention
docs: Add sidebar section header plugin docs— Missingarea: descriptionprefix — e.g.frontend: HomeButton: Fix so it navigates to homeorbackend: config: Add enable-dynamic-clusters flag.
Commit guidelines
- Use atomic commits focused on a single change.
- Use the title format
<area>: <Description of changes>— description must start with a capital letter. - Keep the title under 72 characters (soft requirement).
- Explain the intention and why the change is needed.
- Make commit titles meaningful and describe what changed.
- Do not add code that a later commit rewrites; squash or reorder commits instead.
- Do not include
Fixes #NNin commit messages.
Good examples:
frontend: HomeButton: Fix so it navigates to homebackend: config: Add enable-dynamic-clusters flag
illume
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
This PR has git conflicts — could you resolve them?
How to resolve conflicts
Rebase or merge the latest main into your branch, resolve the conflicts, and push the updated branch.
Signed-off-by: Soli0222 <github@str08.net>
Signed-off-by: Soli0222 <github@str08.net>
Keep subheader child lists inside list items so sidebar lists remain valid HTML. Signed-off-by: Soli0222 <github@str08.net>
Use Immer's Draft type directly for sidebar entry assignment. Signed-off-by: Soli0222 <github@str08.net>
Target the rendered child link elements in subheader lists so the intended spacing and font-size styles apply. Signed-off-by: Soli0222 <github@str08.net>
Document the sidebar subheader entry option so plugin authors can find how to group sidebar entries with non-clickable headers. Signed-off-by: Soli0222 <github@str08.net>
|
@illume CI is green now. I rebased this branch onto the latest upstream/main, resolved the conflict in I also updated the docs commit title to match the scoped style used by commits such as Could you please take another look? For future reference, could you clarify what exactly was wrong with the previous commit title |
|
@Soli0222 I think something like this would be good:
It makes it clear to the reader of the subject, which area was changed. Note: we also don't use signed-off-by in this repo, but use a CLA bot instead. So these could be left out in future. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: illume, Soli0222 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary
This PR adds support for non-clickable sidebar section headers that plugins can register through
registerSidebarEntry.Sidebar entries with
entryType: 'subheader'are rendered as section headers. Existing sidebar entries continue to render as clickable links by default, so existingregisterSidebarEntryusage remains compatible.Related Issue
Fixes #6107
Changes
entryTypefield to sidebar entries.entryType: 'subheader'inSidebarItem.ListSubheaderwhen the sidebar is expanded.Dividerwhen the sidebar is collapsed.sxstyle overrides for subheader entries.registerSidebarEntryso plugins can passentryTypeandsx.Steps to Test
Register a regular sidebar entry without
entryTypeand confirm it still renders as a clickable link.Register a sidebar entry with
entryType: 'subheader'and confirm it renders as a non-clickable section header.Collapse the sidebar and confirm the section header is rendered as a divider instead of text.
Run the focused frontend checks.
Screenshots (if applicable)
Notes for the Reviewer
entryType: 'link'by default.