Fix: When the 'Quick Toggle' dropdown list is too long, the truncated…#354
Fix: When the 'Quick Toggle' dropdown list is too long, the truncated…#354hzfi wants to merge 1 commit into
Conversation
… content will be replaced with a scrollbar.
📝 WalkthroughWalkthroughThe rule content switcher now allows wider dropdown items, adds a transition for item interactions, and enables automatic overflow adjustment for the dropdown. ChangesRule content dropdown
Estimated code review effort: 2 (Simple) | ~5 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/share/components/rule-content-switcher.tsx`:
- Around line 125-132: Remove the horizontal translate from the hover and
semi-dropdown-item-hover styles in the .semi-dropdown-menu .semi-dropdown-item
rule, preserving the existing hover background color and padding so items remain
fully visible within the clipped menu.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 360462db-d8c1-4595-8358-5b029d5065a4
📒 Files selected for processing (1)
src/share/components/rule-content-switcher.tsx
| .semi-dropdown-menu .semi-dropdown-item { | ||
| padding: 8px 12px; | ||
|
|
||
| &:hover, | ||
| &.semi-dropdown-item-hover { | ||
| background-color: var(--semi-color-secondary-light-default); | ||
| transform: translateX(8px) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Avoid translating items inside a horizontally clipped menu.
.semi-dropdown-menu sets overflow-x: hidden, but hovered items are shifted 8px to the right. This can clip the item’s right edge—particularly on platforms where the vertical scrollbar consumes horizontal space—so content may still be visually truncated.
Suggested fix
&:hover,
&.semi-dropdown-item-hover {
background-color: var(--semi-color-secondary-light-default);
- transform: translateX(8px)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| .semi-dropdown-menu .semi-dropdown-item { | |
| padding: 8px 12px; | |
| &:hover, | |
| &.semi-dropdown-item-hover { | |
| background-color: var(--semi-color-secondary-light-default); | |
| transform: translateX(8px) | |
| } | |
| .semi-dropdown-menu .semi-dropdown-item { | |
| padding: 8px 12px; | |
| &:hover, | |
| &.semi-dropdown-item-hover { | |
| background-color: var(--semi-color-secondary-light-default); | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/share/components/rule-content-switcher.tsx` around lines 125 - 132,
Remove the horizontal translate from the hover and semi-dropdown-item-hover
styles in the .semi-dropdown-menu .semi-dropdown-item rule, preserving the
existing hover background color and padding so items remain fully visible within
the clipped menu.
Fix: When the 'Quick Toggle' dropdown list is too long, the truncated content will be replaced with a scrollbar.
Summary by CodeRabbit
Style
Bug Fixes