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

fix(text-field): Adjust the baseline of text field's helper text to match spec #3069

Merged
merged 20 commits into from
Aug 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f02f054
fix(text-field): Fixed the baseline of helper text
abhiomkar Jul 13, 2018
37ecac9
fix(text-field): Moved line-height to typography baseline mixin
abhiomkar Jul 13, 2018
3b5bbad
fix(text-field): Removed margin-bottom from helper text
abhiomkar Jul 13, 2018
c06dd4e
feat(typography): Updated baseline mixin to include styles for ::after
abhiomkar Jul 16, 2018
93a22b2
feat(typography): Added text baseline mixin with a demo
abhiomkar Jul 16, 2018
6293f53
feat(typography): Fixed stylelint errors
abhiomkar Jul 16, 2018
07287ec
fix(text-field): Merged typography branch here
abhiomkar Jul 16, 2018
4930296
feat(typography): Divided baseline mixin into two seperate mixins
abhiomkar Jul 23, 2018
54ebe4b
Merge branch 'typography_text_baseline' into textfield_helper_text_ba…
abhiomkar Jul 24, 2018
6b3557e
fix(text-field): Use updated baseline mixin
abhiomkar Jul 24, 2018
3578a2b
Merge remote-tracking branch 'origin/master' into textfield_helper_te…
abhiomkar Jul 25, 2018
b132601
fix(text-field): Removed white-space chars from helper text
abhiomkar Jul 25, 2018
b246aee
fix(text-field): Used flexbox on baseline line struts to avoid extra …
abhiomkar Jul 30, 2018
f31641e
fix(text-field): minor change - removed extra white-space from demo
abhiomkar Jul 30, 2018
16a904f
Merge remote-tracking branch 'origin/master' into textfield_helper_te…
abhiomkar Jul 30, 2018
a3a1543
Merge remote-tracking branch 'origin/master' into textfield_helper_te…
abhiomkar Aug 1, 2018
139fbc8
fix(text-field): Reverted helper text README
abhiomkar Aug 1, 2018
2bfa646
fix(text-field): Removed unused parameter in typography private mixin
abhiomkar Aug 1, 2018
de69151
fix(text-field): Use visibility instead of display when show/hide hel…
abhiomkar Aug 1, 2018
3d304b4
fix(text-field): Updated other helper texts to use visibility in demo
abhiomkar Aug 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions demos/text-field.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@

<section class="example">
<h2>Full Functionality JS Component (Floating Label, Validation)</h2>
<section id="demo-text-field-wrapper">
<section id="demo-text-field-wrapper" class="demo-text-field-wrapper">
<div class="mdc-text-field">
<input type="text" class="mdc-text-field__input" id="full-func-text-field"
aria-controls="my-text-field-helper-text"
Expand All @@ -80,7 +80,7 @@ <h2>Full Functionality JS Component (Floating Label, Validation)</h2>
<div class="mdc-line-ripple"></div>
</div>
<p id="my-text-field-helper-text" class="mdc-text-field-helper-text"
aria-hidden="true" style="display:none;">
aria-hidden="true" style="visibility: hidden">
Helper Text (possibly validation message)
</p>
</section>
Expand Down Expand Up @@ -138,7 +138,7 @@ <h2>Password field with validation</h2>

<section class="example">
<h2>Outlined Text Field</h2>
<div id="demo-tf-outlined-wrapper">
<div id="demo-tf-outlined-wrapper" class="demo-text-field-wrapper">
<div id="tf-outlined-example" class="mdc-text-field mdc-text-field--outlined" data-demo-no-auto-js>
<input type="text" id="tf-outlined-input" class="mdc-text-field__input"
aria-controls="name-validation-message"
Expand Down Expand Up @@ -188,7 +188,7 @@ <h2>Outlined Text Field</h2>

<section class="example" id="text-field-box-example">
<h2>Text Field box</h2>
<div id="demo-tf-box-wrapper">
<div id="demo-tf-box-wrapper" class="demo-text-field-wrapper">
<div id="tf-box-example" class="mdc-text-field mdc-text-field--box" data-demo-no-auto-js>
<input type="text" id="tf-box" class="mdc-text-field__input"
aria-controls="box-name-validation-message"
Expand All @@ -197,8 +197,7 @@ <h2>Text Field box</h2>
<div class="mdc-line-ripple"></div>
</div>
<p class="mdc-text-field-helper-text"
id="box-name-validation-message"
style="display: none;">
id="box-name-validation-message" style="visibility: hidden">
Helper Text (possibly validation message)
</p>
</div>
Expand Down Expand Up @@ -276,7 +275,7 @@ <h2>Text Field - Leading/Trailing icons</h2>
<div class="mdc-notched-outline__idle"></div>
</div>
</div>
<div id="demo-tf-outlined-trailing-wrapper">
<div id="demo-tf-outlined-trailing-wrapper" class="demo-text-field-wrapper">
<div id="tf-outlined-trailing-example"
class="mdc-text-field mdc-text-field--outlined mdc-text-field--with-trailing-icon" data-demo-no-auto-js>
<input type="text" id="tf-outlined-trailing" class="mdc-text-field__input">
Expand Down Expand Up @@ -333,7 +332,7 @@ <h2>Preventing FOUC</h2>

<section class="example">
<h2>Textarea</h2>
<section id="demo-text-field-textarea-wrapper">
<section id="demo-text-field-textarea-wrapper" class="demo-text-field-wrapper">
<div class="mdc-text-field mdc-text-field--textarea">
<textarea id="textarea" class="mdc-text-field__input" rows="8" cols="40"></textarea>
<label for="textarea" class="mdc-floating-label">Textarea Label</label>
Expand All @@ -359,7 +358,7 @@ <h2>Textarea</h2>

<section class="example">
<h2>Full-Width Text Field and Textarea</h2>
<div id="demo-fullwidth-wrapper">
<div id="demo-fullwidth-wrapper" class="demo-text-field-wrapper">
<div class="mdc-text-field mdc-text-field--fullwidth">
<input class="mdc-text-field__input" type="text" placeholder="Subject" aria-label="Subject">
<div class="mdc-line-ripple"></div>
Expand Down Expand Up @@ -504,7 +503,7 @@ <h2>Custom error state behaviour - remove error state as soon as invalid input i

document.getElementById('box-use-helper-text').addEventListener('change', function(evt) {
var target = evt.target;
helperText.style.display = target.checked ? 'block' : 'none';
helperText.style.visibility = target.checked ? 'visible' : 'hidden';
document.getElementById('box-persistent-helper-text').disabled = !target.checked;
document.getElementById('box-helper-text-as-validation').disabled = !target.checked;
});
Expand Down Expand Up @@ -660,7 +659,7 @@ <h2>Custom error state behaviour - remove error state as soon as invalid input i
});
document.getElementById('use-helper-text').addEventListener('change', function(evt) {
var target = evt.target;
helperText.style.display = target.checked ? 'block' : 'none';
helperText.style.visibility = target.checked ? 'visible' : 'hidden';
document.getElementById('persistent-helper-text').disabled = !target.checked;
document.getElementById('helper-text-as-validation').disabled = !target.checked;
});
Expand Down
5 changes: 5 additions & 0 deletions demos/text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,8 @@
@include mdc-text-field-helper-text-color(rgba(blue, .6));
}
// stylelint-enable selector-class-pattern

.demo-text-field-wrapper {
margin-bottom: 8px;
}

12 changes: 9 additions & 3 deletions demos/typography.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ <h6 class="mdc-typography--subtitle2">Subtitle 2</h6>

<h6 class="mdc-typography--headline6 demo-typography--heading-baseline">Baseline</h6>
<section class="demo-typography--section-baseline">
<h2 class="demo-typography__title mdc-typography--headline6">Our Changing Planet</h2>
<h3 class="demo-typography__subtitle mdc-typography--subtitle2">by Kurt Wagner</h3>
<div class="demo-typography__body mdc-typography--body2">Visit ten places on our planet that are undergoing the biggest changes today.</div>
<h2 class="demo-typography__title mdc-typography--headline6">
Our Changing Planet
</h2>
<h3 class="demo-typography__subtitle mdc-typography--subtitle2">
by Kurt Wagner
</h3>
<div class="demo-typography__body mdc-typography--body2">
Visit ten places on our planet that are undergoing the biggest changes today.
</div>

<line class="demo-typography-line-1">+34px</line>
<line class="demo-typography-line-2">+22px</line>
Expand Down
2 changes: 0 additions & 2 deletions packages/mdc-list/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ in the double line list style as defined by
</ul>
```

> NOTE: Make sure that there are no white-space characters before primary and secondary text.

### List Groups

Multiple related lists can be grouped together using the `mdc-list-group` class on a containing element.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,12 @@

.mdc-text-field-helper-text {
@include mdc-typography(caption);
@include mdc-typography-baseline-top(16px);

margin: 0;
transition: mdc-text-field-transition(opacity);
opacity: 0;
will-change: opacity;

// stylelint-disable plugin/selector-bem-pattern
.mdc-text-field + & {
margin-bottom: 8px;
}

// stylelint-enable plugin/selector-bem-pattern
}

.mdc-text-field-helper-text--persistent {
Expand Down
1 change: 0 additions & 1 deletion packages/mdc-textfield/mdc-text-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

display: inline-block;
position: relative;
margin-bottom: 8px;
will-change: opacity, transform, color;
}

Expand Down
13 changes: 8 additions & 5 deletions packages/mdc-typography/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,26 +42,29 @@
}

@mixin mdc-typography-baseline-top($distance) {
display: flex;
align-items: baseline;
margin-top: 0;
line-height: normal;

&::before {
@include mdc-typography-baseline-strut_($distance, 0);
@include mdc-typography-baseline-strut_($distance);
}
}

@mixin mdc-typography-baseline-bottom($distance) {
margin-bottom: -1 * $distance;

&::after {
@include mdc-typography-baseline-strut_($distance, -1 * $distance);
@include mdc-typography-baseline-strut_($distance);

align-items: flex-start;
}
}

@mixin mdc-typography-baseline-strut_($distance, $vertical-align) {
display: inline-block;
@mixin mdc-typography-baseline-strut_($distance) {
display: inline-flex;
width: 0;
height: $distance;
content: "";
vertical-align: $vertical-align;
}