-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(material-experimental/mdc-typography): update mdc components typography to match spec #21676
Conversation
08b60ab
to
46a63f6
Compare
46a63f6
to
9ea2b49
Compare
// MDC uses the `subtitle1` level for list items, but the spec shows `body1` as the correct | ||
// level. | ||
.mat-mdc-option { | ||
@include mdc-typography(body1, $query: $mat-typography-styles-query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These seem to be the same between autocomplete and select. Maybe we should do it once inside the option theme instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't see an existing mixin for option typography
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's mat-mdc-option-typography
. Also now that I'm thinking about it, we likely need the same typography change for mat-optgroup
since it uses the same size as the option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hmm, don't know how I missed that, I'll move it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just took a look through the external & internal specs as well as demos, and I don't see anything that mentions menu/option groups. I guess maybe we'll just have to pick something reasonable looking for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The groups are set up to look like options, except that they aren't clickable, so the same styles can be applied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think they're currently set to be subtitle1 which makes sense, after the typography levels are updated it'll wind up looking nearly identical to the options (except for the letter spacing) https://material.io/design/typography/the-type-system.html#type-scale
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created a PR based on this one that uses a config created from MDC's typography settings: #21709 That should give an idea of how things should eventually end up looking. Though looking at it, the form-field appears to need a little more work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like they're using the overline
level for the option group, we may want to do that too but I'll leave it for another PR.
f8ffaf2
to
57459a5
Compare
I discussed with Jeremy and we decided its best to roll the function to create a typography config from MDC's values into this PR. I've updated it and added a demo of the latest code in the PR description. |
Yeah it does look a little weird. I think the paginator is just applying the dense form-field styles (which does not change the font size). I can try adding some overrides though |
added an override for the paginator and updated the demo |
// MDC uses the `subtitle1` level for list items, but the spec shows `body1` as the correct | ||
// level. Class is repeated for increased specificity. | ||
.mat-mdc-option { | ||
@include mdc-typography(body1, $query: $mat-typography-styles-query); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a bug filed for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an internal one filed against our gmat components - the difference is almost imperceptible with the external spec, just the letter spacing is different. I haven't opened an bug against MDC yet.
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intentional to not include bottom
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the idea is to behave like the non-MDC form-field where the user can add multiple error/hint or long ones that wrap, but they'll have to reserve space for it themselves. We only reserve space in the layout for one line worth of message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should maybe talk about this- I think we should change our behavior over to what mdc does, but I know that would be pretty breaking, so we should think about doing a follow-up that lets users switch.
border: none; | ||
} | ||
|
||
// In order to ensure proper alignment of the floating label, we reset its line-height. | ||
// The line-height is not important as the element is absolutely positioned and only has one line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of saying "is not important", would it be accurate to say "doesn't affect the size of the element" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really, it does affect the size of the element - its just that we absolutely position the element, so the size doesn't affect the rest of the layout, and its not important as far as the line spacing since labels are only one line anyways
e488100
to
fa8e7a2
Compare
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
…refer 2018 typography mappings if the config is compatible
…correct typography levels
fa8e7a2
to
ba8d5d6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
ba8d5d6
to
12d9064
Compare
12d9064
to
63ac863
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This PR contains several change that bring the MDC-based components in line with the spec w.r.t typography.
body-1
andbody-2
levels. Since the config is based on MDC's values it containsrem
measurements rather thanpx
measurements that Angular Material as traditionally used. In this PR the new config is used in the dev-app only for the MDC-based components. The MDC-based config is currently not compatible with the old components, but it will be made compatible in a followup PR.body-1
looks very similar tosubtitle-1
which lead to them being used interchangeably).Demo: https://mmalerba-demo.web.app/mdc-autocomplete
CARETAKER NOTE: mmalerba will handle syncing