Skip to content

[pickers] Fix disabled state styling for PickersTextField standard and filled variants#22189

Open
LukasTy wants to merge 1 commit intomui:masterfrom
LukasTy:claude/elated-elgamal-156602
Open

[pickers] Fix disabled state styling for PickersTextField standard and filled variants#22189
LukasTy wants to merge 1 commit intomui:masterfrom
LukasTy:claude/elated-elgamal-156602

Conversation

@LukasTy
Copy link
Copy Markdown
Member

@LukasTy LukasTy commented Apr 24, 2026

Summary

Only the outlined variant of PickersTextField greyed out its text when disabled — standard and filled kept the text at the default primary color, making them visually indistinguishable from the enabled state.

Root cause: the shared PickersInputBaseRoot (used by all three variants) had no disabled color rule. Only PickersOutlinedInput compensated by adding its own '*': { color: palette.action.disabled } override. The filled and standard variant roots never applied a disabled text color, so the text stayed at palette.text.primary.

Fix

  • Add a &.${pickersInputBaseClasses.disabled} rule to PickersInputBaseRoot that sets color: palette.action.disabled and cursor: 'default'. Since the three variant roots all extend PickersInputBaseRoot via styled(PickersInputBaseRoot, ...), all three inherit the rule.
  • Drop the now-redundant '*': { color: palette.action.disabled } block from PickersOutlinedInput. Kept the notchedOutline border color rule since that's outlined-specific.

Using palette.action.disabled (rather than MUI's palette.text.disabled) keeps the outlined variant pixel-identical to today and applies the same shade to filled and standard.

Test plan

  • pnpm test:unit --project "x-date-pickers" --run
  • pnpm test:unit --project "x-date-pickers-pro" --run
  • Visual check: render DatePicker / DateTimePicker / DateRangePicker with disabled for each variant (outlined, filled, standard) and confirm the section text, separators, and label all appear greyed out.
  • Spot-check the enabled state of each variant for no regression.

Visual comparison

Before After
Screenshot 2026-04-24 at 18 12 42 Screenshot 2026-04-24 at 17 10 25

…d filled variants

Only the outlined variant greyed out its text when disabled. The shared
PickersInputBaseRoot had no disabled color rule, and only PickersOutlinedInput
compensated with its own override. Move the disabled text color rule to the
base root so all three variants inherit it, and drop the now-redundant
override from the outlined variant.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@LukasTy LukasTy self-assigned this Apr 24, 2026
@LukasTy LukasTy added scope: pickers Changes related to the date/time pickers. design: ui Visual design. type: bug It doesn't behave as expected. needs cherry-pick The PR should be cherry-picked to master after merge. v8.x labels Apr 24, 2026
@code-infra-dashboard
Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 🔺+42B(+0.02%) 🔺+20B(+0.03%)
@mui/x-date-pickers-pro 🔺+34B(+0.01%) 🔺+12B(+0.02%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)

Details of bundle changes

Deploy preview

https://deploy-preview-22189--material-ui-x.netlify.app/


Check out the code infra dashboard for more information about this PR.

@LukasTy LukasTy marked this pull request as ready for review April 24, 2026 14:44
Copy link
Copy Markdown
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

Fixes inconsistent disabled-state text styling in PickersTextField so that standard and filled variants grey out their content the same way outlined already did, by moving the disabled text color rule to the shared base root.

Changes:

  • Add a disabled-state rule to PickersInputBaseRoot to apply palette.action.disabled text color and a default cursor.
  • Remove the redundant “force all children to disabled color” override from PickersOutlinedInput while keeping the outlined-specific disabled border styling.

Reviewed changes

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

File Description
packages/x-date-pickers/src/PickersTextField/PickersOutlinedInput/PickersOutlinedInput.tsx Removes redundant disabled '*' color override now handled by the shared base root.
packages/x-date-pickers/src/PickersTextField/PickersInputBase/PickersInputBase.tsx Adds a shared disabled-state text color + cursor rule so all variants inherit consistent styling.

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

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

Labels

design: ui Visual design. needs cherry-pick The PR should be cherry-picked to master after merge. scope: pickers Changes related to the date/time pickers. type: bug It doesn't behave as expected. v8.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants