Skip to content

Commit

Permalink
fix: Remove margin Safari sets on buttons (#1529)
Browse files Browse the repository at this point in the history
Co-authored-by: Vincent Smedinga <[email protected]>
  • Loading branch information
alimpens and VincentSmedinga authored Aug 26, 2024
1 parent 302ae75 commit 2ccc1bc
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 4 deletions.
11 changes: 10 additions & 1 deletion packages/css/src/components/accordion/accordion.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,16 @@
margin-inline: 0;
}

@mixin reset-button {
border: 0;
margin-block: 0; // [1]
margin-inline: 0; // [1]

// [1] Remove the margin in older Safari.
}

.ams-accordion__button {
background-color: transparent;
border: 0;
color: var(--ams-accordion-button-color);
cursor: pointer;
display: flex;
Expand All @@ -35,6 +42,8 @@
padding-inline: var(--ams-accordion-button-padding-inline);
text-align: start;

@include reset-button;

&:focus {
outline-offset: var(--ams-accordion-button-focus-outline-offset);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/css/src/components/button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

@mixin reset-button {
border: 0;
margin-block: 0; // [1]
margin-inline: 0; // [1]

// [1] Remove the margin in older Safari.
}

.ams-button {
Expand Down
1 change: 1 addition & 0 deletions packages/css/src/components/header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
font-weight: var(--ams-page-menu-item-font-weight);
line-height: var(--ams-page-menu-item-line-height);
margin-block: 0;
margin-inline: 0;
padding-inline: 0 1.875rem;
text-align: center;
touch-action: manipulation;
Expand Down
4 changes: 4 additions & 0 deletions packages/css/src/components/icon-button/icon-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

@mixin reset {
border: 0;
margin-block: 0; // [1]
margin-inline: 0; // [1]
padding-block: 0;
padding-inline: 0;

// [1] Remove the margin in older Safari.
}

.ams-icon-button {
Expand Down
6 changes: 3 additions & 3 deletions packages/css/src/components/search-field/search-field.scss
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@

@mixin reset-button {
border: 0;
margin-block: 0; // [1]
margin-inline: 0; // [1]

// Reset margins added by Safari on iOS
margin-block: 0;
margin-inline: 0;
// [1] Remove the margin in older Safari.
}

.ams-search-field__button {
Expand Down
4 changes: 4 additions & 0 deletions packages/css/src/components/tabs/tabs.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
@mixin reset-button {
background-color: transparent;
border: 0;
margin-block: 0; // [1]
margin-inline: 0; // [1]

// [1] Remove the margin in older Safari.
}

.ams-tabs {
Expand Down

0 comments on commit 2ccc1bc

Please sign in to comment.