Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[docs] Fix a few scroll issues on mobile #7900

Merged
merged 11 commits into from
Feb 20, 2023

Conversation

@oliviertassinari oliviertassinari added bug 🐛 Something doesn't work docs Improvements or additions to the documentation labels Feb 10, 2023
@mui-bot
Copy link

mui-bot commented Feb 10, 2023

Messages
📖 Netlify deploy preview: https://deploy-preview-7900--material-ui-x.netlify.app/

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 653.9 1,139 733.5 856.56 167.321
Sort 100k rows ms 649.9 1,193.4 649.9 920.24 178.457
Select 100k rows ms 281.6 400.7 304.4 330.4 46.188
Deselect 100k rows ms 162.4 326.2 210.9 233.44 60.453

Generated by 🚫 dangerJS against 3fa54d9

@@ -78,6 +78,7 @@ function LocalisationTable(props) {
<MarkdownElement
sx={{
width: '100%',
px: [2, 0],
Copy link
Member Author

Choose a reason for hiding this comment

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

docs/data/date-pickers/fields/LifeCycleDateRangeField.tsx Outdated Show resolved Hide resolved
@@ -65,6 +65,7 @@ function CustomLayout(props: PickersLayoutProps<Dayjs | null, Dayjs, DateView>)
<PickersLayoutRoot
ownerState={props}
sx={{
overflow: 'auto',
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -105,7 +105,9 @@ export function DemoContainer(props: DemoGridProps) {

let direction: StackProps['direction'];
let spacing: StackProps['spacing'];
let sx: StackProps['sx'];
let sx: StackProps['sx'] = {
overflow: 'auto',
Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Really nice improvements! 💯
Left a few improvement comments as well as a suggestion to limit the PR impact to only docs scope. 🤔

@LukasTy LukasTy added the mobile Targets mobile platform label Feb 14, 2023
@oliviertassinari

This comment was marked as outdated.

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Nice result! 👍
I do agree that those simple demos with only one element can benefit from increased simplicity by removing the redundant DemoContainer wrapper.
If we ever add certain styling logic, which would be needed for them—it's not a rocket science to re-introduce it. 👌

If we are removing it from demos having one example, could we also remove DemoContainer from https://deploy-preview-7900--material-ui-x.netlify.app/x/react-date-pickers/date-picker/#basic-usage ?

What's your take on it @flaviendelangle? After all, it's "your baby". 🙈

@flaviendelangle
Copy link
Member

I think that DemoContainer makes a lot of sense when we need to add a label above each demo. For the case where there are 2 - 3 demos in an example without a label, I would personally be more inclined to use Stack but why not DemoContainer.

It also handles the responsive rules when several items can be placed next to one another.
I would not be in favor of removing it when we have several items, even if they have no label at the GridItem level.
Removing it when there is only one item, why not, I can double check if I don't see any regression.

@LukasTy
Copy link
Member

LukasTy commented Feb 15, 2023

It also handles the responsive rules when several items can be placed next to one another. I would not be in favor of removing it when we have several items, even if they have no label at the GridItem level. Removing it when there is only one item, why not, I can double check if I don't see any regression.

I've looked through the changes and the only regression is with the DateTime(Field|Picker).
I do also agree that it's only sensible to drop it from demos having a single component and this is what has been done by Olivier. 😉

@oliviertassinari oliviertassinari changed the title [docs] Fix scroll on mobile [docs] Fix a few scroll issues on mobile Feb 15, 2023
@oliviertassinari
Copy link
Member Author

For the SEO fix, I will fix it directly with the demo container in the main repo, we should have had overflow: auto there in the first place.

Actually, we didn't add overflow: auto on purpose in the main docs demo wrapper because we want each demo to be self contained. So, it's not an option, I have added back what I had.

@oliviertassinari oliviertassinari force-pushed the fix-static-overflow branch 3 times, most recently from 5f78e0e to 102d953 Compare February 15, 2023 15:49
@flaviendelangle
Copy link
Member

I've looked through the changes and the only regression is with the DateTime(Field|Picker).

Nice 👌
I'm ok with the change then

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Feb 15, 2023

Ok, I think that I'm good now. I have pushed forward with the DemoContainer approach. In HEAD, there are many cases that have the wrong dimensions, check:

But I get why, it's hard to get it right! You have to constantly check each change on many different pages. I could improve a bit the situation, but I couldn't make it work everywhere. I felt that the best way to get something reliably great is to take the DemoContainer abstraction and go one level lower, with hard coding more width values in each demo (we do need an abstraction, e.g. for the overflow but not for the width, there are too many different cases possible for the width:

  • Long date format (e.g. date time with second range vs. date range), it's the same component but the length needed is way different
  • Long outline label

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Looking great! 👍
Left a few comments and a question to Flavien.

alignItems="stretch"
spacing={spacing}
sx={sx}
className={textFieldClasses.root}
Copy link
Member

Choose a reason for hiding this comment

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

Was there something that required adding this class here? 🤔
The final result is a bit strange, where we end up with nested MuiTextField-root classes. 🙈
Screenshot 2023-02-16 at 11 16 39

Copy link
Member Author

@oliviertassinari oliviertassinari Feb 19, 2023

Choose a reason for hiding this comment

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

And example of issue is https://next.mui.com/x/react-date-pickers/time-range-field/#uncontrolled-vs-controlled that doesn't receive the right min width because there is a DemoItem wrapper, but I have reverted. We don't have to fix this in this PR.

@@ -9,6 +9,7 @@ export default function TimePickerViews() {
<LocalizationProvider dateAdapter={AdapterDayjs}>
<DemoContainer
components={['MobileTimePicker', 'MobileTimePicker', 'MobileTimePicker']}
sx={{ minWidth: 210 }}
Copy link
Member Author

@oliviertassinari oliviertassinari Feb 19, 2023

Choose a reason for hiding this comment

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

Related to this fix mui/material-ui#36246, the label label={'"hours", "minutes" and "seconds"'} overflows.

Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

LGTM! 💯
Thank you for all the effort! 🙏
I've looked through Argos changes and didn't find any regressions there, so I approved the changes.
There is still the issue of static landscape pickers having overflow: hidden that prevents the content from being interacted with on narrow viewports, but that is probably better resolved by a separate PR looking into feasibility of changing the overflow:hidden to possibly overflow: auto. 👍

@oliviertassinari
Copy link
Member Author

Great, it turned out to be more work than I thought, but it was a great forcing function for me to read all the pages of the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work docs Improvements or additions to the documentation mobile Targets mobile platform
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants