Skip to content
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: Remove margin Safari sets on buttons #1529

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
}

.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 {
VincentSmedinga marked this conversation as resolved.
Show resolved Hide resolved
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