Skip to content

Dropdown component toggle methods (ToggleAsync etc.) not working as expected #1025

@MarcinWatroba

Description

@MarcinWatroba

Description
Dropdown component toggle methods such as ToggleAsync and ShowAsync always display dropdown menu of the first dropdown component in the page. This occurs in global server side rendering (haven't tested other types of rendering).

Example: You have Dropdown A and Dropdown B, with their respective menus, Menu A and Menu B.
When calling ToggleAsync method on either Dropdown A or Dropdown B, Dropdown A menu appears. Dropdown B menu never appears.

To Reproduce
Use sample code provided

Expected behavior
Menu A should appear when toggling Dropdown A, Menu B should appear when toggling Dropdown B

Screenshots

Image

Versions:

  • .NET Version: .NET8
  • BlazorBootstrap: 3.3.1
  • Blazor WebAssembly / Server: Server
  • Blazor Interactive Render Mode: Server
  • Blazor Interactivity Location: global

Sample code
I replaced DropdownToggleButton with button in this example but it does not matter where the toggle method is called.
I tried assigning custom unique ids and names to each component too and nothing helped.

Same issue persists when first custom toggle button is swapped for DropdownToggleButton
When instead the second custom toggle button is swapped for DropdownToggleButton the issue no longer occurs.

Tried uploading code block but markdown completely messed it up, so here's screenshot:

Image

GitHub repo
Can create one if needed

Desktop (please complete the following information):

  • OS: Windows 11, macOS 15
  • Browser: Chrome, Safari
  • Version Chrome 132, Safari 18.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions