Skip to content

MudComboBoxItem: Disabled items can still be selected by clicking #659

Open

Description

@mckaragoz

Bug description

MudComboBoxItem does not prevent selection when Disabled is set to true.

Although disabled items are visually marked and excluded from eligible item lists, clicking a disabled item can still change the selected value.

Root cause

MudComboBoxItem.HandleOnClick() does not check the Disabled state before calling MudComboBox.ToggleOption().

Additionally, ToggleOption() does not independently reject disabled items.

Expected behavior

  • Disabled items must not be selectable through mouse interaction.
  • Clicking a disabled item must not change the ComboBox selection.
  • Disabled items must not trigger selection-related callbacks.

Suggested fix

Ensure disabled items cannot initiate selection through HandleOnClick(), and consider enforcing the same restriction in ToggleOption() to protect the selection logic consistently.

Regression test

A regression test has already been introduced in PR #656:

ComboBox_DisabledItemShouldNotBeSelectable

The test is currently marked with [Ignore] to document the known issue without breaking CI.

Once fixed, the test should be enabled and verified.

Credits

This issue was discovered during the expanded ComboBox and ComboBoxItem test coverage contributed in #656.

Thanks to @Yomodo for the valuable contribution and for identifying an existing behavioral bug while improving our test coverage!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions