Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Nov 15, 2025

Link issues

fixes #7121

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Prevent text overflow in menu items by introducing a .submenu-link wrapper with overflow hidden and updating the SCSS structure accordingly.

Bug Fixes:

  • Prevent menu item text from overflowing its container by wrapping link content in a constrained element

Enhancements:

  • Update Menu.razor.scss to nest selectors and introduce overflow handling on the new .submenu-link element
  • Rename the wrapper div in MenuLink.razor from flex-fill to submenu-link to apply the new overflow styles

Copilot AI review requested due to automatic review settings November 15, 2025 07:14
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 15, 2025

Reviewer's Guide

This PR adds a new CSS class to prevent text from overflowing in menu items by applying flex and overflow rules, refactors the Menu component SCSS to use nested syntax and improve readability, and updates the Razor component to apply the new style.

Class diagram for updated MenuLink component structure

classDiagram
    class MenuLink {
        +NavLink
        +submenu-link : div
        +menu-text : span
        +IconString : i
    }
    MenuLink --|> BootstrapComponentBase
Loading

File-Level Changes

Change Details Files
Prevent text overflow in menu links
  • Define .submenu-link with flex:1 1 auto, min-width:0, width:1%, white-space:nowrap, overflow:hidden, and margin-inline-end
  • Replace wrapper div class in MenuLink.razor from flex-fill to submenu-link
src/BootstrapBlazor/Components/Menu/Menu.razor.scss
src/BootstrapBlazor/Components/Menu/MenuLink.razor
Refactor and reorganize SCSS for Menu component
  • Remove BOM and correct @use import formatting
  • Convert flat selectors into nested blocks under .menu and related contexts
  • Adjust indentations and group related style rules for clarity
src/BootstrapBlazor/Components/Menu/Menu.razor.scss

Assessment against linked issues

Issue Objective Addressed Explanation
#7121 Truncate or ellipsize overly long navigation menu text so that it does not overflow and does not affect the display of the expansion arrow.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added the bug Something isn't working label Nov 15, 2025
@bb-auto bb-auto bot added this to the 10.0.0 milestone Nov 15, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • Verify that the nested SCSS selectors maintain the same specificity and don’t inadvertently alter existing menu styles (e.g., bottom or cascade variants).
  • Consider renaming the submenu-link class to something more descriptive of its overflow‐handling role rather than implying it only applies to submenus.
  • Test the new overflow truncation across various viewport sizes and RTL layouts to ensure menu text remains legible and unclipped.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Verify that the nested SCSS selectors maintain the same specificity and don’t inadvertently alter existing menu styles (e.g., bottom or cascade variants).
- Consider renaming the `submenu-link` class to something more descriptive of its overflow‐handling role rather than implying it only applies to submenus.
- Test the new overflow truncation across various viewport sizes and RTL layouts to ensure menu text remains legible and unclipped.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@ArgoZhang ArgoZhang enabled auto-merge (squash) November 15, 2025 07:16
@codecov
Copy link

codecov bot commented Nov 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (aa4d7d2) to head (c0f1d39).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7124   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          745       745           
  Lines        32548     32548           
  Branches      4510      4510           
=========================================
  Hits         32548     32548           
Flag Coverage Δ
BB 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ArgoZhang ArgoZhang merged commit d764813 into main Nov 15, 2025
12 checks passed
@ArgoZhang ArgoZhang deleted the chore-config branch November 15, 2025 07:17
Copy link
Contributor

Copilot AI left a 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 adds CSS styles to prevent text overflow in menu items, addressing issue #7121. The changes introduce a wrapper div with overflow handling to ensure long menu text is properly truncated.

  • Changed the menu link content wrapper from generic flex-fill class to a specific submenu-link class
  • Added CSS rules for text overflow prevention with flexbox-based truncation
  • Reformatted the entire SCSS file with consistent indentation

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/BootstrapBlazor/Components/Menu/MenuLink.razor Updated the div wrapper class from flex-fill to submenu-link to support overflow styling
src/BootstrapBlazor/Components/Menu/Menu.razor.scss Added new .submenu-link style rules with flex and overflow properties to handle text truncation; reformatted entire file with consistent indentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

min-width: 0;
width: 1%;
white-space: nowrap;
overflow: hidden;
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

The overflow prevention is missing text-overflow: ellipsis; to show an ellipsis (...) when text is truncated. Without this property, the text will be cut off abruptly. Consider adding text-overflow: ellipsis; to improve the user experience when menu text overflows.

Suggested change
overflow: hidden;
overflow: hidden;
text-overflow: ellipsis;

Copilot uses AI. Check for mistakes.
.menu .nav-link > .submenu-link {
flex: 1 1 auto;
min-width: 0;
width: 1%;
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

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

[nitpick] The width: 1% property appears to be used as a flexbox hack to force the container to respect min-width: 0. While this is a known technique, it may not be necessary here since min-width: 0 with flex: 1 1 auto is typically sufficient for text truncation. Consider testing if removing width: 1% still achieves the desired overflow behavior.

Suggested change
width: 1%;

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

导航菜单文字过长没有省略

2 participants