Skip to content

style: improve sidebar item layout, focus style, and spacing - #29078

Merged
MohamedH1998 merged 14 commits into
productionfrom
style/sidebar-improvements
Mar 20, 2026
Merged

style: improve sidebar item layout, focus style, and spacing#29078
MohamedH1998 merged 14 commits into
productionfrom
style/sidebar-improvements

Conversation

@MohamedH1998

@MohamedH1998 MohamedH1998 commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Use the preview branch in style: toc design improvements to view the all the changes in conjunction with another

What changed

  • Override on the SidebarSublist - we were doing a lot of hacky things to customise this component, it made more sense to just create an override and create the compont ourselves
  • Aligned the styling closer to what we're seeing in the dashboard
  • Focus ring — added keyboard-only focus styles (focus-visible:outline-blue-500 / dark:focus-visible:outline-blue-400) to sidebar links and group toggles, matching the existing pattern used on the sidebar search input; outline-offset-0 keeps the ring flush to the element so it does not overlap adjacent items
  • Focus ring clip fix — added padding-top: 1px to .sidebar-content to match the gap value, preventing the focus outline on the first sidebar item from being clipped

Before
Screenshot 2026-03-19 at 22 24 42

Screenshot 2026-03-19 at 22 24 53

After
Screenshot 2026-03-19 at 22 24 01

Screenshot 2026-03-19 at 22 24 13

Screen recording
https://github.com/user-attachments/assets/bb3424be-e62c-42fd-8ff5-eb996e33f96d

Screen.Recording.2026-03-19.at.22.37.08.mov

@github-actions

github-actions Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:

Pattern Owners
*.ts @cloudflare/content-engineering, @kodster28
/src/components/ @cloudflare/content-engineering, @kodster28
*.astro @cloudflare/content-engineering, @kodster28
* @cloudflare/pcx-technical-writing

@github-actions

github-actions Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

@MohamedH1998
MohamedH1998 marked this pull request as ready for review March 18, 2026 14:20
@MohamedH1998
MohamedH1998 requested review from a team and kodster28 as code owners March 18, 2026 14:20
@MohamedH1998
MohamedH1998 requested a review from a team March 18, 2026 14:20
Comment thread src/components/overrides/SidebarSublist.astro Outdated
Comment thread src/components/overrides/SidebarSublist.astro Outdated
Comment thread src/components/overrides/SidebarSublist.astro Outdated
Comment thread src/components/overrides/Sidebar.astro Outdated
@MohamedH1998
MohamedH1998 marked this pull request as draft March 18, 2026 17:50
@pedrosousa

pedrosousa commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Just checked the preview and I noticed that in dark mode the selected item for current page is not very visible (at least in my screen).
image

You were probably handling dark mode next, but leaving this here as a piece of feedback.

@MohamedH1998
MohamedH1998 marked this pull request as ready for review March 19, 2026 16:50
@mvvmm

mvvmm commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

/bonk please review

Comment thread src/components/overrides/SidebarSublist.astro Outdated
Comment thread src/styles/sidebar.css

@ask-bonk ask-bonk Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the sidebar styling improvements.

Addressed from ahaywood's review:

  • Empty class attribute on line 90 of SidebarSublist.astro - posted inline suggestion
  • Dark mode active state visibility - noted the contrast concern from pedrosousa's feedback

Regarding the animation question: The JavaScript animation control (is-user-toggled class) is necessary to prevent CSS transitions from firing on page load when the sidebar state is restored from sessionStorage. CSS alone cannot distinguish between initial state restoration and user-initiated toggles.

Type safety: The flattenSidebar function properly types its parameter as SidebarEntry[], which is correct. The function is used internally and the types flow correctly through the component.

@ask-bonk

ask-bonk Bot commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Review complete. Posted:

  1. Inline suggestion on SidebarSublist.astro:90 — remove empty string from class:list
  2. Comment on sidebar.css:62 — dark mode active state visibility concern
  3. General review summary addressing ahaywood's review points, including:
    • Why JavaScript is needed for animation control (distinguishes user toggles from page load state restoration)
    • Type safety confirmation for flattenSidebar function

github run

MohamedH1998 and others added 2 commits March 19, 2026 22:39
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
* style: header design tweaks

* fix: align vertically

* style: toc design improvements (#29124)

* style: toc design improvements

* fix: keyboard nav in feedback form

* fix: decrease textarea rows

* fix: vertical alignment of the toc

* Update src/components/overrides/TableOfContents.astro

Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>

---------

Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>

---------

Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
@MohamedH1998
MohamedH1998 merged commit 69282f4 into production Mar 20, 2026
13 checks passed
@MohamedH1998
MohamedH1998 deleted the style/sidebar-improvements branch March 20, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants