Skip to content

Conversation

rita-codes
Copy link
Member

@rita-codes rita-codes commented Jul 30, 2025

Issue #18972

Remove redundant RTL-specific layout override for pickers

This PR removes a custom style override for isRtl: true. It was causing layout issues in RTL mode, and is not needed, the default layout behaves correctly under dir="rtl" without extra overrides.

Tested in both RTL and LTR: layout now renders as expected.

Bug reproduction
https://github.com/user-attachments/assets/e1c2961d-865a-49c4-9ea0-92b71a865814

Demo (fixed)
https://github.com/user-attachments/assets/81cc08cd-b570-4aef-bc90-ac778f08b2ec

Screenshot 2025-07-30 at 11 13 45

@rita-codes rita-codes self-assigned this Jul 30, 2025
@rita-codes rita-codes added type: bug It doesn't behave as expected. scope: pickers Changes related to the date/time pickers. labels Jul 30, 2025
@rita-codes rita-codes requested a review from a team July 30, 2025 09:29
@mui-bot
Copy link

mui-bot commented Jul 30, 2025

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

Bundle size report

Bundle Parsed Size Gzip Size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid/DataGrid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro/DataGridPro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium/DataGridPremium 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-date-pickers 🔺+115B(+0.05%) 🔺+51B(+0.08%)
@mui/x-date-pickers-pro 🔺+115B(+0.04%) 🔺+51B(+0.06%)
@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

Generated by 🚫 dangerJS against 8d4f99e

@flaviendelangle
Copy link
Member

I tried with some shortcuts just in case:

            <MobileDatePicker
              label="Mobile Date Picker"
              defaultValue={dayjs('2022-04-17')}
              slotProps={{
                mobilePaper: {
                  dir: 'rtl',
                },
                shortcuts: {
                  items: shortcutsItems,
                },
              }}
            />

Before:

image

After:

image

So your fix doesn't cause any regression, but we have another issue 😆

@rita-codes
Copy link
Member Author

I tried with some shortcuts just in case:

            <MobileDatePicker
              label="Mobile Date Picker"
              defaultValue={dayjs('2022-04-17')}
              slotProps={{
                mobilePaper: {
                  dir: 'rtl',
                },
                shortcuts: {
                  items: shortcutsItems,
                },
              }}
            />

Before:

image After: image So your fix doesn't cause any regression, but we have another issue 😆

ohhh 🙈

Let me check if I can quickly fix that too! Good catch!

@rita-codes
Copy link
Member Author

rita-codes commented Jul 30, 2025

Actually @flaviendelangle I think this is how it should look like 🧐 (RTL), so even when no shortcuts are rendered, the date selection remains positioned at the top rather than on the side. Am I right?

Screenshot 2025-07-30 at 14 02 04

@flaviendelangle
Copy link
Member

image

According to the Material Design 2 spec the toolbar should be on the side.
I think it would make sense to have it on the side when there is no shortcut, and when there is some shortcuts to move it above.
If that's doable

@rita-codes rita-codes force-pushed the 18972-pickers-muipickerslayout-toolbar-is-overlapping-the-calendar-in-rtl-mobiledatepicker-variant branch from e388d2a to a10cbd9 Compare July 30, 2025 18:21
…overlapping-the-calendar-in-rtl-mobiledatepicker-variant
@rita-codes rita-codes requested review from flaviendelangle and removed request for a team July 30, 2025 18:22
@rita-codes
Copy link
Member Author

rita-codes commented Jul 30, 2025

rita-codes and others added 2 commits July 31, 2025 10:20
Copy link
Member

@flaviendelangle flaviendelangle left a comment

Choose a reason for hiding this comment

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

Thanks for taking care of it 🙏

});
}) as PickersShortcutsProps<TValue>;

const hasShortcuts = Array.isArray(shortcutsProps?.items) && shortcutsProps.items.length > 0;
Copy link
Member

Choose a reason for hiding this comment

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

😢 Always sad when we need to fake some data in the owner state because we need the resolved slot props to create the owner state.

I don't have a better solution without a breaking change though :/

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that was the part that made me think "Maybe there's a better solution" 😢

Copy link
Member

Choose a reason for hiding this comment

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

Not with the current architecture
Base UI approach makes this kind of stuff a lot easier to handle...

@rita-codes rita-codes merged commit a0cbf5f into mui:master Jul 31, 2025
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: pickers Changes related to the date/time pickers. type: bug It doesn't behave as expected.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[pickers] MuiPickersLayout-toolbar is overlapping the Calendar in RTL MobileDatePicker variant
3 participants