Skip to content

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

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

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

Conversation

@MohamedH1998
Copy link
Contributor

@MohamedH1998 MohamedH1998 commented Mar 18, 2026

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
Copy link
Contributor

github-actions bot commented Mar 18, 2026

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
Copy link
Contributor

github-actions bot commented Mar 18, 2026

@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 marked this pull request as draft March 18, 2026 17:50
@pedrosousa
Copy link
Contributor

pedrosousa commented Mar 19, 2026

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
Copy link
Contributor

mvvmm commented Mar 19, 2026

/bonk please review

Copy link
Contributor

@ask-bonk ask-bonk bot left a comment

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
Copy link
Contributor

ask-bonk bot commented Mar 19, 2026

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