Skip to content

Pickers: Fix ReadOnly not respected in PickerVariant.Static#12785

Merged
danielchalmers merged 2 commits intodevfrom
copilot/fix-readonly-static-datepicker
Mar 1, 2026
Merged

Pickers: Fix ReadOnly not respected in PickerVariant.Static#12785
danielchalmers merged 2 commits intodevfrom
copilot/fix-readonly-static-datepicker

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 1, 2026

MudDatePicker, MudDateRangePicker, and MudTimePicker with PickerVariant.Static and ReadOnly="true" still allowed date/time selection. Although SubmitAsync guarded against persisting values, the intermediate selection state (_selectedDate, _firstDate, _secondDate, TimeIntermediate) was set before the guard, causing visual changes and actual value mutations in the static variant.

Changes

  • MudDatePicker — Early return on GetReadOnlyState() in OnDayClickedAsync, OnMonthSelectedAsync, and OnYearClickedAsync
  • MudDateRangePicker — Early return on GetReadOnlyState() in OnDayClickedAsync
  • MudTimePicker — Early return on GetReadOnlyState() in UpdateTimeAsync (shared entry point for both pointer-move and stick-click interactions)
<MudDatePicker PickerVariant="PickerVariant.Static" ReadOnly="true" @bind-Date="_date" />
<!-- Clicking any day no longer changes _date or the visual selection state -->

Three unit tests added covering the static + ReadOnly scenario for each affected picker.

Original prompt

This section details on the original issue you should resolve

<issue_title>MudDatePicker not respecting ReadOnly in PickerVariant.Static</issue_title>
<issue_description>### Bug type

Component

Component name

MudDatePicker

What happened?

When using a DatePicker in static mode, it doesn't respect ReadOnly, when setting ReadOnly to true, it still lets you interact with the control and select a date.

Expected behavior

No date selection possible when readonly.

Reproduction link

https://try.mudblazor.com/snippet/wkcxaUbCPPrHTiyy

Reproduction steps

  1. Add DatePicker
  2. Set to PickerVariant.Static
  3. Set to ReadOnly
  4. Interaction is still occuring.

Relevant log output

No response

Version (bug)

6.4.1

Version (working)

No response

What browsers are you seeing the problem on?

Firefox, Chrome, Microsoft Edge, Safari, Other

On what operating system are you experiencing the issue?

Windows, Mac OSX, Linux, iOS, Android, Other

Pull Request

  • I would like to do a Pull Request

Code of Conduct

  • I agree to follow this project's Code of Conduct</issue_description>

<agent_instructions>Fix this on each picker in a minimal and targeted way</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@danielchalmers @binbsr Niche issue so it's unlikely to be fixed unless someone submits a PR

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…icker, MudTimePicker)

Co-authored-by: danielchalmers <7112040+danielchalmers@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix MudDatePicker not respecting ReadOnly in static mode Fix ReadOnly not respected in PickerVariant.Static for date and time pickers Mar 1, 2026
@danielchalmers danielchalmers marked this pull request as ready for review March 1, 2026 22:29
@mudbot mudbot bot changed the title Fix ReadOnly not respected in PickerVariant.Static for date and time pickers MudDatePicker, MudDateRangePicker, MudTimePicker: Fix ReadOnly not respected in PickerVariant.Static Mar 1, 2026
@mudbot mudbot bot added the bug Unexpected behavior or functionality not working as intended label Mar 1, 2026
@danielchalmers danielchalmers changed the title MudDatePicker, MudDateRangePicker, MudTimePicker: Fix ReadOnly not respected in PickerVariant.Static Pickers: Fix ReadOnly not respected in PickerVariant.Static Mar 1, 2026
@danielchalmers danielchalmers merged commit 76c9ffe into dev Mar 1, 2026
12 checks passed
@ScarletKuro ScarletKuro deleted the copilot/fix-readonly-static-datepicker branch March 1, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unexpected behavior or functionality not working as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MudDatePicker not respecting ReadOnly in PickerVariant.Static

2 participants