Skip to content

Commit

Permalink
fix(field): use margin for textarea content
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 548159696
  • Loading branch information
asyncLiz authored and copybara-github committed Jul 14, 2023
1 parent 6116ed8 commit 7fdd0c4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
11 changes: 10 additions & 1 deletion field/lib/_content.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,18 @@ $_enter-delay: $_label-duration - $_visible-duration;
// below.
color: currentColor;
font: var(--_content-type);
width: 100%;
}

.content ::slotted(:not(textarea)) {
padding-top: var(--_top-space);
padding-bottom: var(--_bottom-space);
width: 100%;
}

.content ::slotted(textarea) {
// Use margin for textareas since they will scroll over the label if not.
margin-top: var(--_top-space);
margin-bottom: var(--_bottom-space);
}

:hover .content {
Expand Down
10 changes: 9 additions & 1 deletion field/lib/_filled-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,21 @@ $_md-sys-motion: tokens.md-sys-motion-values();
padding-inline-end: var(--_trailing-space);
}

.field:not(.no-label) .content ::slotted(*) {
.field:not(.no-label) .content ::slotted(:not(textarea)) {
padding-bottom: var(--_with-label-bottom-space);
padding-top: calc(
var(--_with-label-top-space) + var(--_label-text-populated-line-height)
);
}

.field:not(.no-label) .content ::slotted(textarea) {
// Use margin for textareas since they will scroll over the label if not.
margin-bottom: var(--_with-label-bottom-space);
margin-top: calc(
var(--_with-label-top-space) + var(--_label-text-populated-line-height)
);
}

:hover .active-indicator::before {
border-bottom-color: var(--_hover-active-indicator-color);
border-bottom-width: var(--_hover-active-indicator-height);
Expand Down

0 comments on commit 7fdd0c4

Please sign in to comment.