Skip to content

fix: edge case where caret isn't moved to left#37

Open
arikorn wants to merge 2 commits intobitfocus:mainfrom
arikorn:fix_css_caret
Open

fix: edge case where caret isn't moved to left#37
arikorn wants to merge 2 commits intobitfocus:mainfrom
arikorn:fix_css_caret

Conversation

@arikorn
Copy link
Contributor

@arikorn arikorn commented Feb 18, 2026

Also carry over change from companion to support dropdown menus with icons.

Summary by CodeRabbit

  • Style
    • Improved visual alignment and consistency of header dropdown icons and sidebar items for a more uniform look.
    • Refined caret placement and behavior across menu states (including sublists and linked pages) to improve visibility and navigation clarity.

Also carry over change from companion to support dropdown menus with icons.
@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Updates src/css/custom.css: expands navbar dropdown selector scope, relocates and unifies caret rules (including pseudo-elements) to the left edge, replaces isolated pseudo-element blocks with grouped rules, and adds explanatory comments around caret/link behavior.

Changes

Cohort / File(s) Summary
CSS Styling
src/css/custom.css
Expanded .navbar-sidebar__items selector to also target .theme-layout-navbar-right .dropdown__menu; moved caret to far-left by unifying .menu__caret and .menu__link--sublist-caret::after rules; replaced isolated ::before block with grouped pseudo-element rules for consistent scaling/margin; added clarifying comment blocks about caret and linked-page behavior.

Poem

✨ Carets shifted, styles extend,
Dropdowns dressed from end to end,
Grouped selectors sing in tune,
CSS humming—nice and soon 🎨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main fix in the changeset - moving the caret to the left in an edge case involving dropdown menus.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/css/custom.css (2)

147-149: Tiny comment nit — the leading comment no longer covers both cases.

The comment on line 147 says "when the window is narrow, the right-header icons are in the pull-down sidebar," but the rule now also targets .theme-layout-navbar-right .dropdown__menu, which is visible on wide windows. It's a small thing, but worth a quick update so future readers aren't confused!

📝 Suggested comment update
-/* when the window is narrow, the right-header icons are in the pull-down sidebar */
+/* when the window is narrow, the right-header icons are in the pull-down sidebar;
+   when the window is wide, the right-header icons can also appear in a dropdown menu */

221-236: Heads-up: &::before is a no-op for the ::after leg of the combined selector.

Inside the shared block, &::before { scale: 0.6; } resolves to two rules:

  • .menu__caret::before { scale: 0.6; } — ✅ valid and applied.
  • .menu__link--sublist-caret::after::before { scale: 0.6; } — ❌ chained pseudo-elements aren't valid CSS; browsers silently drop it.

The actual scaling of ::after is correctly handled by the new standalone rule at lines 234–236, so the behavior is right! This is purely a readability note — someone skimming the shared block might assume &::before applies to both legs. Totally fine to leave as-is since it works, but splitting the selectors would make the intent crystal-clear:

✨ Optional clarity refactor
-/* move the expand/contract caret to the far left for improved visibility/group offsetting.
-   The second class is active if the subdirectory has no linked-page (so clicking on it just opens the sublist w/o changing the main panel.
-   */
-.menu__caret,
-.menu__link--sublist-caret::after {
+/* move the expand/contract caret to the far left for improved visibility/group offsetting. */
+.menu__caret {
 	order: -1;
 	padding-left: 0.45em;
 	padding-right: 0;
 	border-radius: 0.5rem 0 0 0.5rem; /* match the outer box's corner */

 	&::before {
 		scale: 0.6;
 	}
 }

-/* when there's no linked page, the caret is in '::after' itself, not nested within the element. */
-.menu__link--sublist-caret::after {
+/* The second class is active if the subdirectory has no linked-page (so clicking on it just opens the sublist w/o changing the main panel).
+   The caret is in '::after' itself, not nested within the element. */
+.menu__link--sublist-caret::after {
+	order: -1;
+	padding-left: 0.45em;
+	padding-right: 0;
+	border-radius: 0.5rem 0 0 0.5rem;
 	scale: 0.6;
 }

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.

1 participant

Comments