Skip to content

Commit

Permalink
fix(text-field): Restrict resize to vertical for full width text area (
Browse files Browse the repository at this point in the history
…material-components#4167)

Restrict resize to vertical for full width text area. 

(cherry picked from commit 77a2bd4)
  • Loading branch information
williamernest authored and Kenneth G. Franqueiro committed Dec 17, 2018
1 parent 3ca21c2 commit 8e6b968
Show file tree
Hide file tree
Showing 7 changed files with 126 additions and 779 deletions.
8 changes: 0 additions & 8 deletions demos/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,6 @@
</span>
</a>

<a href="text-field.html" role="listitem" class="mdc-list-item">
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_text_field_24px.svg" /></span>
<span class="mdc-list-item__text">
<span class="mdc-list-item__primary-text">Text field</span>
<span class="mdc-list-item__secondary-text">Single and multiline text fields</span>
</span>
</a>

<a href="theme/index.html" role="listitem" class="mdc-list-item">
<span class="demo-catalog-list-icon mdc-list-item__graphic"><img src="/images/ic_theme_24px.svg" /></span>
<span class="mdc-list-item__text">
Expand Down
634 changes: 0 additions & 634 deletions demos/text-field.html

This file was deleted.

134 changes: 0 additions & 134 deletions demos/text-field.scss

This file was deleted.

8 changes: 7 additions & 1 deletion packages/mdc-textfield/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,13 @@ included as part of the DOM structure of a full width text field.
```html
<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>
<div class="mdc-notched-outline">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label for="textarea" class="mdc-floating-label">Textarea Label</label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
</div>
```

Expand Down
4 changes: 4 additions & 0 deletions packages/mdc-textfield/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,10 @@
padding: 0;
}
}

&.mdc-text-field--textarea .mdc-text-field__input {
resize: vertical;
}
}

@mixin mdc-text-field-fullwidth-invalid_ {
Expand Down
12 changes: 10 additions & 2 deletions test/screenshot/golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,14 @@
"desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/classes/textarea-focused.html.windows_ie_11.png"
}
},
"spec/mdc-textfield/classes/textarea-fullwidth.html": {
"public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/12/12/17_48_24_713/spec/mdc-textfield/classes/textarea-fullwidth.html?utm_source=golden_json",
"screenshots": {
"desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/12/12/17_48_24_713/spec/mdc-textfield/classes/textarea-fullwidth.html.windows_chrome_71.png",
"desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/12/12/17_48_24_713/spec/mdc-textfield/classes/textarea-fullwidth.html.windows_firefox_63.png",
"desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/12/12/17_48_24_713/spec/mdc-textfield/classes/textarea-fullwidth.html.windows_ie_11.png"
}
},
"spec/mdc-textfield/classes/textarea-invalid.html": {
"public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/classes/textarea-invalid.html?utm_source=golden_json",
"screenshots": {
Expand All @@ -1578,10 +1586,10 @@
}
},
"spec/mdc-textfield/issues/3332.html": {
"public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/issues/3332.html?utm_source=golden_json",
"public_url": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/12/12/18_21_57_178/spec/mdc-textfield/issues/3332.html?utm_source=golden_json",
"screenshots": {
"desktop_windows_chrome@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/issues/3332.html.windows_chrome_70.png",
"desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/issues/3332.html.windows_edge_17.png",
"desktop_windows_edge@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/12/12/18_21_57_178/spec/mdc-textfield/issues/3332.html.windows_edge_17.png",
"desktop_windows_firefox@latest": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/issues/3332.html.windows_firefox_63.png",
"desktop_windows_ie@11": "https://storage.googleapis.com/mdc-web-screenshot-tests/travis/2018/11/21/19_18_38_795/spec/mdc-textfield/issues/3332.html.windows_ie_11.png"
}
Expand Down
105 changes: 105 additions & 0 deletions test/screenshot/spec/mdc-textfield/classes/textarea-fullwidth.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
<!DOCTYPE html>
<!--
Copyright 2018 Google Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Full Width Textarea Text Field - MDC Web Screenshot Test</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../../../out/mdc.textfield.css">
<link rel="stylesheet" href="../../../out/mdc.typography.css">
<link rel="stylesheet" href="../../../out/spec/fixture.css">
<link rel="stylesheet" href="../../../out/spec/mdc-textfield/fixture.css">

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-118996389-2"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-118996389-2');
</script>
</head>

<body class="test-container">
<main class="test-viewport test-viewport--mobile">
<div class="test-layout">

<div class="test-cell test-cell--textarea">
<div class="mdc-text-field mdc-text-field--textarea mdc-text-field--fullwidth">
<textarea id="full-width-textarea"
class="mdc-text-field__input test-text-field__input"
rows="2"></textarea>
<div class="mdc-notched-outline">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label for="full-width-textarea" class="mdc-floating-label">Textarea Label</label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
</div>
</div>

<div class="test-cell test-cell--textarea">
<div class="mdc-text-field mdc-text-field--textarea mdc-text-field--fullwidth">
<textarea id="full-width-textarea-filled"
class="mdc-text-field__input test-text-field__input"
rows="2">Xyz</textarea>
<div class="mdc-notched-outline mdc-notched-outline--notched">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label for="full-width-textarea-filled" class="mdc-floating-label mdc-floating-label--float-above">Textarea Label</label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
</div>
</div>

<div class="test-cell test-cell--textarea">
<div class="mdc-text-field mdc-text-field--textarea mdc-text-field--fullwidth">
<!-- htmllint-disable -->
<textarea id="full-width-textarea-long-filled"
class="mdc-text-field__input test-text-field__input"
rows="2">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur rhoncus ac risus a eleifend. Phasellus dictum luctus leo quis ultricies. Vivamus fringilla vehicula turpis eu eleifend. Donec ultricies, est a scelerisque laoreet, arcu eros commodo nunc, sit amet hendrerit diam nisi id velit. Suspendisse porta nibh orci. Donec velit nisl, accumsan vitae eros a, consectetur interdum eros. Aenean dapibus vulputate semper. Aliquam finibus nec leo sed ultricies. Integer luctus convallis risus. Etiam suscipit suscipit ante vel volutpat. Ut venenatis dapibus elit dictum fringilla.</textarea>
<div class="mdc-notched-outline mdc-notched-outline--notched">
<div class="mdc-notched-outline__leading"></div>
<div class="mdc-notched-outline__notch">
<label for="full-width-textarea-long-filled" class="mdc-floating-label mdc-floating-label--float-above">Textarea Label</label>
</div>
<div class="mdc-notched-outline__trailing"></div>
</div>
<!-- htmllint-enable -->
</div>
</div>

</div>
</main>

<!-- Automatically provides/replaces `Promise` if missing or broken. -->
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.js"></script>
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fontfaceobserver/2.0.13/fontfaceobserver.standalone.js"></script>
<script src="../../../out/material-components-web.js"></script>
<script src="../../../out/spec/fixture.js"></script>
<script src="../../../out/spec/mdc-textfield/fixture.js"></script>
</body>
</html>

0 comments on commit 8e6b968

Please sign in to comment.