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(button): prevent icon and tooltip jumping for tertiary button #5618

Merged
merged 8 commits into from
Mar 16, 2020
50 changes: 2 additions & 48 deletions packages/components/src/components/button/_button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
$hover-tertiary,
currentColor,
$active-tertiary,
1px
);

&:hover {
Expand Down Expand Up @@ -112,19 +111,6 @@
}
}

.#{$prefix}--btn--tertiary,
.#{$prefix}--btn--tertiary.#{$prefix}--btn--field,
.#{$prefix}--btn--tertiary.#{$prefix}--btn--sm {
padding-right: rem(62px);
padding-left: rem(14px);

&:focus {
border-width: rem(3px);
padding-right: rem(60px);
padding-left: rem(12px);
}
}

.#{$prefix}--btn--ghost {
@include button-theme(
transparent,
Expand Down Expand Up @@ -177,7 +163,6 @@

.#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--tooltip__trigger:focus {
border-color: $focus;
box-shadow: inset 0 0 0 $button-outline-width $ui-02;
}

.#{$prefix}--btn.#{$prefix}--btn--icon-only.#{$prefix}--tooltip__trigger:focus
Expand All @@ -195,8 +180,8 @@
}

.#{$prefix}--btn--icon-only {
padding-left: rem(13px);
padding-right: rem(13px);
padding-left: rem(15px);
padding-right: rem(15px);

.#{$prefix}--btn__icon {
position: static;
Expand Down Expand Up @@ -232,44 +217,14 @@
display: none;
}

.#{$prefix}--btn--icon-only.#{$prefix}--btn--tertiary {
padding-left: rem(15px);
padding-right: rem(15px);

&:focus {
padding-left: rem(13px);
padding-right: rem(13px);
}
}

.#{$prefix}--btn--field.#{$prefix}--btn--icon-only {
padding-left: rem(9px);
padding-right: rem(9px);
}

.#{$prefix}--btn--field.#{$prefix}--btn--icon-only.#{$prefix}--btn--tertiary {
padding-left: rem(11px);
padding-right: rem(11px);

&:focus {
padding-left: rem(9px);
padding-right: rem(9px);
}
}

.#{$prefix}--btn--sm.#{$prefix}--btn--icon-only {
padding-left: rem(5px);
padding-right: rem(5px);
}

.#{$prefix}--btn--sm.#{$prefix}--btn--icon-only.#{$prefix}--btn--tertiary {
padding-left: rem(7px);
padding-right: rem(7px);

&:focus {
padding-left: rem(5px);
padding-right: rem(5px);
}
}

.#{$prefix}--btn--danger {
Expand All @@ -284,7 +239,6 @@

&:hover {
color: $text-04;
border: $button-border-width solid transparent;
}
}

Expand Down
7 changes: 4 additions & 3 deletions packages/components/src/components/button/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,9 @@
$hover-bg-color,
$icon-color,
$active-color,
$border-width: $button-border-width
) {
background-color: $bg-color;
border-width: $border-width;
border-width: $button-outline-width;
border-style: solid;
border-color: $border-color;
color: $font-color;
Expand All @@ -73,7 +72,9 @@

&:focus {
border-color: $focus;
box-shadow: inset 0 0 0 $button-outline-width $ui-02;
box-shadow:
inset 0 0 0 ($button-border-width - $button-outline-width) $focus,
inset 0 0 0 ($button-border-width) $ui-02;
}

&:disabled:hover,
Expand Down
12 changes: 1 addition & 11 deletions packages/components/src/globals/scss/_theme-tokens.scss
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,13 @@ $button-padding-ghost-sm: calc(0.375rem - 3px) 12px !default;
/// @type Number
/// @access public
/// @group button
$button-border-width: 3px !default;
$button-border-width: 2px !default;

/// @type Number
/// @access public
/// @group button
$button-outline-width: 1px !default;

/// @type Number
/// @access public
/// @group button
$button-outline-offset: -5px !default;

/// @type Value
/// @access public
/// @group button
$button-outline: 1px solid $ibm-color__white-0 !default;

// Accordion

/// @type Value
Expand Down