-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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(notched-outline): Fix label overflow #4171
Merged
Merged
Changes from 3 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
22f9204
fix(notched-outline): Fix label overflow
williamernest fc76390
WIP: Update screenshots
williamernest 14f54ab
Merge branch 'master' into fix/notched-outline/fix-overflow
williamernest 18a26a7
WIP: Update float-above to apply when upgraded
williamernest 9ac532f
WIP: Update float-above to apply when upgraded
williamernest 773aea8
Merge branch 'master' into fix/notched-outline/fix-overflow
williamernest 690db0a
WIP: Split adapter method into 2
williamernest 2f38a5c
WIP: Add flex to notch to fix IE11 label overflow
williamernest cbd20e3
Merge branch 'master' into fix/notched-outline/fix-overflow
williamernest c3fc1d0
WIP: Update for comments. Convert label to scrollWidth. Improve flex …
williamernest 923431a
Merge branch 'master' into fix/notched-outline/fix-overflow
williamernest d5240fd
WIP: Remove commented code
williamernest a895950
WIP: Change floating label float-above text overflow to clip
williamernest 4c97ae6
feat(notched-outline): Update goldens
williamernest c6fe116
Merge branch 'master' into fix/notched-outline/fix-overflow
williamernest 1bf46a3
Merge branch 'master' into fix/notched-outline/fix-overflow
kfranqueiro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
/* @noflip */ | ||
text-align: left; | ||
pointer-events: none; | ||
max-width: 100%; | ||
|
||
@include mdc-rtl { | ||
/* @noflip */ | ||
|
@@ -69,13 +70,20 @@ | |
|
||
&__notch { | ||
width: auto; | ||
max-width: 100%; | ||
} | ||
|
||
.mdc-floating-label { | ||
display: inline-block; | ||
position: relative; | ||
top: 17px; | ||
bottom: auto; | ||
max-width: 100%; | ||
} | ||
|
||
.mdc-floating-label--float-above { | ||
max-width: calc(100% / .75); | ||
kfranqueiro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
text-overflow: clip; | ||
kfranqueiro marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Discussed in DM) Is it safe to apply this even when not upgraded, to avoid the ellipsis appearing then disappearing once JS runs? |
||
} | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>Textarea Text Field - Long Label - 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"> | ||
<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 That Is Really Really Really Really Long</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"> | ||
<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 That Is Really Really Really Really Long</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"> | ||
<!-- 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 That Is Really Really Really Really Long</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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Should this be handled in the foundation and exposed as 2 adapter APIs rather than making this one more complex (and less intuitive given its name)?
This is kind of a breaking change regardless of whether we make it 2 APIs or change the behavior of the 1. And if we change it here, we need to document the API's expected behavior. IMO splitting it is simpler to understand by wrapper libraries.
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'll split this up into 2 API's and move the logic to the foundation.