-
Notifications
You must be signed in to change notification settings - Fork 694
Use specific classes for fluent menu items when styling to prevent text overflow #9827
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use specific classes for fluent menu items when styling to prevent text overflow #9827
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces specific CSS classes to control text overflow on Fluent menu items and updates relevant components to use those classes, preventing text from spilling out of menu containers.
- Added scoped selectors and an overflow-specific class for Fluent menu items in CSS
- Updated
FluentMenu
andFluentMenuItem
usages to include the new classes - Adjusted a component comment to explain the styling approach
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/Aspire.Dashboard/wwwroot/css/app.css | Scopes fluent-menu-item::part(content) rules and adds an overflow utility class |
src/Aspire.Dashboard/Components/Layout/MobileNavMenu.razor | Adds aspire-menu-container class to the mobile nav FluentMenu |
src/Aspire.Dashboard/Components/Dialogs/TextVisualizerDialog.razor | Applies overflow-fluent-menu-item class to menu items in dialog |
src/Aspire.Dashboard/Components/Controls/AspireMenu.razor | Adds aspire-menu-container class on FluentMenu and includes a guiding comment |
Comments suppressed due to low confidence (2)
src/Aspire.Dashboard/Components/Controls/AspireMenu.razor:6
- This comment is misleading: the
aspire-menu-container
class is actually applied on<FluentMenu>
, not its parent. Please update or remove the comment so it aligns with the implementation.
@* aspire-menu-container is added to the div parent of FluentMenu, not the FluentMenu *@
src/Aspire.Dashboard/wwwroot/css/app.css:789
- [nitpick] No tests cover the new overflow styling; consider adding a visual regression or component test to ensure text-overflow behavior remains consistent.
fluent-menu-item::part(content) {
} | ||
|
||
fluent-menu-item::part(content) { | ||
.aspire-menu-container > fluent-menu > fluent-menu-item::part(content) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CSS selector assumes .aspire-menu-container
wraps the <fluent-menu>
, but you applied the class directly on the <FluentMenu>
element. As a result the rule won’t match. Either move the class to a parent container or adjust the selector to target fluent-menu.aspire-menu-container
.
.aspire-menu-container > fluent-menu > fluent-menu-item::part(content) { | |
fluent-menu.aspire-menu-container > fluent-menu-item::part(content) { |
Copilot uses AI. Check for mistakes.
fluent-menu-item::part(content) { | ||
.aspire-menu-container > fluent-menu > fluent-menu-item::part(content) { | ||
width: 100%; | ||
text-overflow: ellipsis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To reliably trigger an ellipsis, you should also include overflow: hidden;
and white-space: nowrap;
on the same element.
text-overflow: ellipsis; | |
text-overflow: ellipsis; | |
overflow: hidden; | |
white-space: nowrap; |
Copilot uses AI. Check for mistakes.
.aspire-menu-container > fluent-menu > fluent-menu-item::part(content) { | ||
width: 100%; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
.overflow-fluent-menu-item::part(content) { | ||
width: 100%; | ||
text-overflow: ellipsis; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Both scoped and utility selectors set identical properties (width: 100%
and text-overflow: ellipsis
). Consider extracting them into a shared rule or CSS variable to reduce duplication.
.aspire-menu-container > fluent-menu > fluent-menu-item::part(content) { | |
width: 100%; | |
text-overflow: ellipsis; | |
} | |
.overflow-fluent-menu-item::part(content) { | |
width: 100%; | |
text-overflow: ellipsis; | |
.full-width-ellipsis { | |
width: 100%; | |
text-overflow: ellipsis; | |
} | |
.aspire-menu-container > fluent-menu > fluent-menu-item::part(content) { | |
@apply .full-width-ellipsis; | |
} | |
.overflow-fluent-menu-item::part(content) { | |
@apply .full-width-ellipsis; |
Copilot uses AI. Check for mistakes.
note: this is blocked on fluentui upgrade |
Description
Fixes #9222
Checklist
<remarks />
and<code />
elements on your triple slash comments?doc-idea
templatebreaking-change
templatediagnostic
template