Skip to content

Commit

Permalink
feat(tabs): use correct vars for focusring
Browse files Browse the repository at this point in the history
  • Loading branch information
pfulton authored and GarthDB committed Jan 24, 2022
1 parent 28302af commit 972c82e
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions components/tabs/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ governing permissions and limitations under the License.
}

.spectrum-Tabs {
/* --spectrum-tabs-item-height-adjusted: calc(var(--spectrum-tabs-height) - var(--spectrum-tabs-quiet-textonly-divider-size)); */
--spectrum-tabs-compact-item-height: calc(var(--spectrum-tabs-compact-textonly-height) - var(--spectrum-tabs-compact-textonly-divider-size));
}

Expand Down Expand Up @@ -76,7 +75,7 @@ governing permissions and limitations under the License.
text-decoration: none;
white-space: nowrap;

transition: color var(--spectrum-global-animation-duration-100) ease-out;
transition: color var(--spectrum-tabs-texticon-tabitem-selection-indicator-animation-duration) ease-out;
cursor: pointer;
outline: none;

Expand Down Expand Up @@ -106,13 +105,8 @@ governing permissions and limitations under the License.

box-sizing: border-box;

block-size: calc(var(--spectrum-tabs-textonly-tabitem-padding-top) + var(--spectrum-tabs-textonly-tabitem-padding-top));

margin-block-start: calc(calc(var(--spectrum-tabs-compact-textonly-tabitem-height) / -2) + calc(var(--spectrum-tabs-quiet-texticon-divider-size) / 2));

/* 30,40,50,60 */

/* margin-block-start: calc(var(--spectrum-tabs-compact-textonly-tabitem-height) / -2); */
block-size: var(--spectrum-tabs-textonly-tabitem-focus-ring-height);
margin-block-start: calc(var(--spectrum-tabs-textonly-tabitem-focus-ring-height) / -2);

inset-inline-start: calc(-1 * var(--spectrum-tabs-textonly-tabitem-focus-ring-padding-x));
inset-inline-end: calc(-1 * var(--spectrum-tabs-textonly-tabitem-focus-ring-padding-x));
Expand Down Expand Up @@ -176,7 +170,6 @@ governing permissions and limitations under the License.

/* Target anything since React likes to add lots of happy <div>s around all things */
& + *:not(.spectrum-Tabs-selectionIndicator) {
/* margin-inline-start: var(--spectrum-tabs-quiet-textonly-tabitem-gap); */
margin-inline-start: var(--spectrum-tabs-textonly-tabitem-margin-right);
}
}
Expand Down Expand Up @@ -215,15 +208,13 @@ governing permissions and limitations under the License.
padding-block: 0;
padding-inline: var(--spectrum-tabs-quiet-textonly-tabitem-focus-ring-padding-x);

/* Subtract focus ring padding from margin-left since the padding value already offsets tabs-items */
/* margin-inline-start: calc(var(--spectrum-tabs-vertical-textonly-margin-left) - var(--spectrum-tabs-quiet-textonly-focus-ring-padding-x)); */
margin-block-end: var(--spectrum-tabs-vertical-textonly-tabitem-gap);
margin-inline-start: calc(var(--spectrum-tabs-vertical-textonly-tabitem-gap) / 2);

&::before {
/* padding is included in click area of tab items, so only need to offset by the size of the focus ring's border */
inset-inline-start: calc(-1 * var(--spectrum-tabs-textonly-tabitem-focus-ring-size));
inset-inline-end: calc(-1 * var(--spectrum-tabs-textonly-tabitem-focus-ring-size));
/* margin-block-start: calc(calc(var(--spectrum-tabs-quiet-textonly-focus-ring-height) / -2)); */
}
}

Expand Down

0 comments on commit 972c82e

Please sign in to comment.