Skip to content

fix(SelectGeneric): add dropdown-menu-body class #6110

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

Merged
merged 2 commits into from
May 29, 2025
Merged

fix(SelectGeneric): add dropdown-menu-body class #6110

merged 2 commits into from
May 29, 2025

Conversation

ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented May 29, 2025

Link issues

fixes #6109

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

Add a wrapper element with the "dropdown-menu-body" class around the dropdown content in SelectGeneric to restore expected styling and streamline group header rendering.

Bug Fixes:

  • Add the missing "dropdown-menu-body" class to the SelectGeneric dropdown container to fix styling regression.

Enhancements:

  • Unify wrapping of items and virtualized lists inside a .dropdown-menu-body div for both virtualize and static modes
  • Refactor group header rendering to use the provided GroupItemTemplate when available or fall back to a Divider component

Copy link
Contributor

sourcery-ai bot commented May 29, 2025

Reviewer's Guide

This PR updates the SelectGeneric component by adding a consistent dropdown-menu-body CSS wrapper for both virtualized and standard option lists and refactors the grouping and item rendering logic to ensure proper templating and remove redundant loops.

Flow Diagram: Update to SelectGeneric Dropdown CSS Wrappers

graph TD
    A[Start Dropdown Rendering] --> IsVirtualize{IsVirtualize?};

    IsVirtualize -- Yes --> V_Path[Virtualized List];
    V_Path --> V_Wrap["Update wrapper: div class includes 'dropdown-menu-body' (now 'dropdown-menu-body dropdown-virtual')"];
    V_Wrap --> V_Content[Render virtualized content];

    IsVirtualize -- No --> NV_Path[Non-Virtualized List];
    NV_Path --> NV_Wrap["Add new wrapper: <div class='dropdown-menu-body'>"];
    NV_Wrap --> NV_Content[Render non-virtualized groups & items];

    V_Content --> Output[Final Dropdown UI];
    NV_Content --> Output;
Loading

File-Level Changes

Change Details Files
Added and standardized dropdown-menu-body container
  • Added “dropdown-menu-body” class to the virtual dropdown container
  • Wrapped non-virtual items inside a
  • Adjusted markup structure and indentation around the new wrapper
src/BootstrapBlazor/Components/SelectGeneric/SelectGeneric.razor
Refactored grouping and item rendering logic
  • Reordered group key check to wrap GroupItemTemplate rendering
  • Introduced default when no custom GroupItemTemplate is provided
  • Removed duplicate item iteration loops and consolidated RenderRow calls inside the grouping loop
src/BootstrapBlazor/Components/SelectGeneric/SelectGeneric.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#6109 Add a dropdown-menu-body class to the dropdown to ensure the dropdown has a maximum height and scrollbar when needed.

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 May 29, 2025
@bb-auto bb-auto bot added this to the v9.6.0 milestone May 29, 2025
@ArgoZhang ArgoZhang requested a review from Copilot May 29, 2025 01:54
@ArgoZhang ArgoZhang merged commit a6167cd into main May 29, 2025
3 checks passed
@ArgoZhang ArgoZhang deleted the fix-select branch May 29, 2025 01:54
Copy link

@Copilot 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 ensures that the SelectGeneric component’s dropdown content is consistently wrapped with a dropdown-menu-body class and bumps the package version.

  • Adds dropdown-menu-body CSS class to both virtualized and non-virtualized dropdown wrappers
  • Increments version from 9.6.5-beta02 to 9.6.5-beta03

Reviewed Changes

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

File Description
SelectGeneric.razor Wrapped virtual and non-virtual list blocks with a <div class="dropdown-menu-body"> for consistent styling
BootstrapBlazor.csproj Updated <Version> to 9.6.5-beta03
Comments suppressed due to low confidence (1)

src/BootstrapBlazor/Components/SelectGeneric/SelectGeneric.razor:44

  • Add or update automated tests to verify that the dropdown-menu-body class is applied when IsVirtualize is both true and false, ensuring styling is consistently applied.
<div class="dropdown-menu-body dropdown-virtual">

@@ -41,7 +41,7 @@
}
@if (IsVirtualize)
{
<div class="dropdown-virtual">
<div class="dropdown-menu-body dropdown-virtual">
Copy link
Preview

Copilot AI May 29, 2025

Choose a reason for hiding this comment

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

Consider updating the component’s documentation or README to note that dropdown content is now wrapped in a dropdown-menu-body class for both virtualized and non-virtualized modes.

Copilot uses AI. Check for mistakes.

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 @ArgoZhang - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

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.

@foreach (var itemGroup in Rows.GroupBy(i => i.GroupName))
{
if (!string.IsNullOrEmpty(itemGroup.Key))
<div class="dropdown-menu-body">
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion (performance): GroupBy is executed on every render in markup

Move the grouping logic to a computed property or backing field to avoid repeated execution and improve performance with large data sets.

Copy link

codecov bot commented May 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (a0834cd) to head (73b967a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #6110   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          703       703           
  Lines        31019     31019           
  Branches      4386      4386           
=========================================
  Hits         31019     31019           

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

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.

bug(SelectGeneric): add dropdown-menu-body class
1 participant