Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
chore(dialog): wrap close button in element
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 688495446
  • Loading branch information
SLaks authored and copybara-github committed Oct 22, 2024
1 parent c4e5361 commit ef11212
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
17 changes: 10 additions & 7 deletions packages/mdc-dialog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,11 @@ Full-screen dialogs group a series of tasks, such as creating a calendar entry w
<h2 class="mdc-dialog__title" id="my-dialog-title">
Full-Screen Dialog Title
</h2>
<button class="mdc-icon-button material-icons mdc-dialog__close"
data-mdc-dialog-action="close">
close
</button>
<div class="mdc-dialog__close-tooltip-wrapper">
<button class="mdc-icon-button material-icons mdc-dialog__close" data-mdc-dialog-action="close">
close
</button>
</div>
</div>
<div class="mdc-dialog__content" id="my-dialog-content">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Expand Down Expand Up @@ -308,9 +309,11 @@ absolutely positioned. Sheet content can have no default padding by using the
<div class="mdc-dialog__scrim" data-mdc-dialog-action="cancel"></div>
<div class="mdc-dialog__container">
<div class="mdc-dialog__surface" tabindex="-1">
<button class="mdc-icon-button material-icons mdc-dialog__close" data-mdc-dialog-action="close">
close
</button>
<div class="mdc-dialog__close-tooltip-wrapper">
<button class="mdc-icon-button material-icons mdc-dialog__close" data-mdc-dialog-action="close">
close
</button>
</div>
<div class="mdc-dialog__content test-dialog__content">
<div class="test-sheet__content">
<h3>Sheets</h3>
Expand Down
14 changes: 8 additions & 6 deletions packages/mdc-dialog/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
}
}

.mdc-dialog__close {
.mdc-dialog__close-tooltip-wrapper {
@include feature-targeting.targets($feat-structure) {
top: 5px;
}
Expand All @@ -253,13 +253,13 @@

// Needed so that close affordance is aligned as if there was a title.
.mdc-dialog--fullscreen--titleless {
.mdc-dialog__close {
.mdc-dialog__close-tooltip-wrapper {
@include feature-targeting.targets($feat-structure) {
margin-top: 4px;
}
}

&.mdc-dialog--scrollable .mdc-dialog__close {
&.mdc-dialog--scrollable .mdc-dialog__close-tooltip-wrapper {
@include feature-targeting.targets($feat-structure) {
margin-top: 0;
}
Expand Down Expand Up @@ -515,7 +515,7 @@
}

.mdc-dialog--sheet {
.mdc-dialog__container .mdc-dialog__close {
.mdc-dialog__container .mdc-dialog__close-tooltip-wrapper {
@include feature-targeting.targets($feat-structure) {
right: variables.$sheet-close-icon-right;
top: variables.$sheet-close-icon-top;
Expand Down Expand Up @@ -1051,7 +1051,8 @@
/// @param {Number} $title-side-padding - Space between the edge of the close
/// icon button and edge of the title.
@mixin _fullscreen-header($close-icon-padding, $title-side-padding) {
.mdc-dialog__close {
.mdc-dialog__close-tooltip-wrapper {
position: relative;
order: -1;
@include theme.property(left, -#{$close-icon-padding});
}
Expand All @@ -1072,7 +1073,8 @@
/// Defines styles for the header bar when a dialog is modal.
/// @param {Number} $close-icon-padding - Padding on close icon button.
@mixin _modal-header($close-icon-padding) {
.mdc-dialog__close {
.mdc-dialog__close-tooltip-wrapper {
position: relative;
@include theme.property(right, -#{$close-icon-padding});
}
}

0 comments on commit ef11212

Please sign in to comment.