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

refactor(notched-outline): Refactor notched outline to use 3 divs #4035

Merged
merged 64 commits into from
Dec 4, 2018

Conversation

williamernest
Copy link
Contributor

@williamernest williamernest commented Nov 1, 2018

Placeholder PR so I can run screenshots.

Notes for diffs:

  • The previous notched outline was drawn in SVG and was not exactly 56px tall, so the SVG-less outline for all instances of a notched-outline that is notched will show diffs in both height and width.
  • The text will shift slightly either up or down and will not render in the exact same location (subpixel shift). I will get them as close as possible but some text will not be possible to align perfectly.

BREAKING CHANGE: The notched outline has been changed from using an SVG for the outline to using 3 div elements. This approach resolves initial rendering issues as well as inconsistencies between the different types of outlines. Please refer to the Readme or the screenshot test pages for details and examples.

packages/mdc-floating-label/mdc-floating-label.scss Outdated Show resolved Hide resolved
packages/mdc-textfield/foundation.js Show resolved Hide resolved
packages/mdc-notched-outline/index.js Outdated Show resolved Hide resolved
packages/mdc-select/_mixins.scss Outdated Show resolved Hide resolved
Copy link
Contributor

@kfranqueiro kfranqueiro left a comment

Choose a reason for hiding this comment

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

Reminder to hit the main text field README for notched-outline updates as well... and we probably need notes in the select and text field READMEs about placing the floating-label inside the notched outline.

There are also still files with the floating label outside the notched outline:

  • demos/text-field.html
  • demos/theme/index.html
  • test/screenshot/spec/mdc-textfield/classes/focused-helper-text-persistent.html (there's one case where there's 2 floating labels, one outside and one inside)
  • test/screenshot/spec/mdc-textfield/classes/focused.html (ditto)

packages/mdc-notched-outline/index.js Outdated Show resolved Hide resolved
packages/mdc-notched-outline/index.js Outdated Show resolved Hide resolved
packages/mdc-floating-label/constants.js Outdated Show resolved Hide resolved
packages/mdc-notched-outline/_mixins.scss Outdated Show resolved Hide resolved
packages/mdc-notched-outline/mdc-notched-outline.scss Outdated Show resolved Hide resolved
packages/mdc-select/_mixins.scss Outdated Show resolved Hide resolved
packages/mdc-select/_mixins.scss Outdated Show resolved Hide resolved
packages/mdc-select/_mixins.scss Outdated Show resolved Hide resolved
packages/mdc-textfield/_mixins.scss Outdated Show resolved Hide resolved
packages/mdc-textfield/_mixins.scss Show resolved Hide resolved
@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report 🚦

313 screenshots changed from master on commit d04990f:

Details

301 Changed:

12 Added:

@thdk
Copy link

thdk commented Dec 1, 2018

Will this issue fix this?

image

There is no outline visible on the right side of the text field.
After you click the textfield the outline on the right side appears and will stay even when clicking outside the textfield.

https://codepen.io/kfranqueiro/pen/QJVObP

Running on windows 10, chrome 70.0.3538.110

Or is this another issue?

@williamernest
Copy link
Contributor Author

williamernest commented Dec 1, 2018 via email

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report 🚦

313 screenshots changed from master on commit 1e04648:

Details

301 Changed:

12 Added:

font-size: ($scale * 1rem);
}

.mdc-notched-outline--upgraded {
Copy link
Contributor

Choose a reason for hiding this comment

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

I removed the "calling mixins with parent selectors" part of the readme since it was obsolete as written... however, this particular mixin still operates under the assumption that the context is a parent, otherwise this selector won't match.

On the other hand, if we were to revise this to &.mdc-notched-outline--upgraded, you would need to select on the notched outline element (not a parent) in order for it to work, which text field and select currently don't.

We could potentially include both selectors (.mdc-notched-outline--upgraded, &.mdc-notched-outline--upgraded), but that's arguably emitting extra styles, and I'm not sure if there'd be any possible side effects.

Typically we set the expectation that applying a mixin to the root class of its component will work. We do make this sort of assumption in a few other places (I searched for &. in code, though half are in private mixins)... what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll make a quick commit adding both selectors and see if it changes anything.

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report 🚦

313 screenshots changed from master on commit 677c83a:

Details

301 Changed:

12 Added:

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report 🚦

313 screenshots changed from master on commit d10994a:

Details

301 Changed:

12 Added:

@mdc-web-bot
Copy link
Collaborator

🤖 Beep boop!

Screenshot test report 🚦

313 screenshots changed from master on commit 955ca04:

Details

301 Changed:

12 Added:

@@ -67,59 +73,24 @@ CSS Class | Description
--- | ---
`mdc-notched-outline` | Mandatory. Container for the SVG of the notched outline path.
Copy link
Contributor

@chaficnajjar chaficnajjar Dec 5, 2018

Choose a reason for hiding this comment

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

@williamernest @kfranqueiro This line in the documentation still mentions SVG despite the notched outline not using SVG anymore.

Copy link
Contributor

Choose a reason for hiding this comment

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

Man, I knew I was still going to miss something in the README. Thanks for pointing it out.

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