Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/share/components/rule-content-switcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,29 @@ interface RuleContentSwitcherProps {
const baseStyle = css`
.semi-dropdown-item,
.semi-dropdown-title {
max-width: 160px;
max-width: 180px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: block;
transition: all 0.25s ease-in-out;
}

.semi-dropdown-menu {
max-height: 300px;
max-width: 180px;
overflow-x: hidden;
overflow-y: auto;
}

.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)
}
Comment on lines +125 to +132

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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.

Suggested change
.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.

}
`;

Expand Down Expand Up @@ -308,6 +326,7 @@ const RuleContentSwitcher: FC<RuleContentSwitcherProps> = props => {
style={{ minWidth: '120px' }}
menu={menu}
position="bottomRight"
autoAdjustOverflow
>
{children}
</Dropdown>
Expand Down