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] Improve font size scaling of some demos #19950

Merged
merged 2 commits into from
Mar 4, 2020

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Mar 3, 2020

Using a fixed width for a demo can give a bad impression when testing font-size scaling of our components. To preserve the "fixed asthetics" we can use ch units. It breaks down on very large scales but it's better than what we currently have.

There are plenty of demos where we could improve the scaling impressions. I think this is a good start. At least for the first demos on a page we should give the best impression possible.

Credits to @missmatsuko for their article.

Using 40px font-size as the base:
before:
https://material-ui.netlify.com/components/text-fields/
Screenshot from 2020-03-03 01-42-22

after:
https://deploy-preview-19950--material-ui.netlify.com/components/text-fields/
Screenshot from 2020-03-03 01-42-14

Argos diff is expected, should be accepted by a reviewer.

@eps1lon eps1lon added docs Improvements or additions to the documentation accessibility a11y labels Mar 3, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Mar 3, 2020

No bundle size changes comparing c7e6eee...084d91f

Generated by 🚫 dangerJS against 084d91f

@eps1lon eps1lon force-pushed the docs/fluid-width branch from ce530c3 to b25ab40 Compare March 3, 2020 00:53
@eps1lon eps1lon force-pushed the docs/fluid-width branch from b25ab40 to 133747b Compare March 3, 2020 00:59
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 3, 2020

What do you think of using 24px as the baseline over 40px? I have looked at the accessibility feature of Chrome, they have the following for the html font-size:

  • very small: 9px
  • small: 12px
  • standard: 16px (default)
  • large: 20px
  • very large: 24px

@oliviertassinari
Copy link
Member

Hum, but at the same time, there is this 200% resize criterion: https://www.w3.org/WAI/WCAG21/Understanding/resize-text.html. Maybe it should be 32px as baseline?

@@ -11,8 +11,6 @@ import Typography from '@material-ui/core/Typography';
const useStyles = makeStyles((theme: Theme) =>
createStyles({
root: {
width: '100%',
maxWidth: 360,
Copy link
Member

@oliviertassinari oliviertassinari Mar 3, 2020

Choose a reason for hiding this comment

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

The change breaks the purpose of the demo:

You should change the list item alignment when displaying 3 lines or more, set the alignItems="flex-start" property.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand the purpose from this sentence. How does the width relate to the number of items?

Copy link
Member

@oliviertassinari oliviertassinari Mar 3, 2020

Choose a reason for hiding this comment

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

The idea is to have list items with enough height to show the impact of the flex positioning of the avatar (top vs middle)

Copy link
Member Author

Choose a reason for hiding this comment

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

So why not set the height instead?

Copy link
Member

Choose a reason for hiding this comment

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

Relying on text wrapping avoids the need to know the computed line-height. In our case, I think that a width ch approach would work.

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 3, 2020

Cool stuff. I had to search for what the ch unit is for, I had forgotten, it's probably the first time I see a good reason for using it: and seems specific for our demos.

@eps1lon
Copy link
Member Author

eps1lon commented Mar 3, 2020

What do you think of using 24px as the baseline over 40px?

I'm not using it as a baseline. It was just a extreme example of a base font size (marked as "huge" in chrome).

I have looked at the accessibility feature of Chrome

I was looking for a better way. How did you find it? I always used the settings directly.

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 3, 2020

I was looking for a better way. How did you find it? I always used the settings directly.

I have used the following, then inspected the agent style sheet (sorry it's in FR):

Capture d’écran 2020-03-03 à 11 15 17

chrome://settings/

@eps1lon
Copy link
Member Author

eps1lon commented Mar 3, 2020

chrome://settings/

Yeah I used the settings as well. Not very handy though since I need to open it in a separate tab. With zoom I can use a shortcut.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility a11y docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants