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

Try: Add a subtle animation to the is-active indicator for sidebar tabs #13956

Merged
merged 8 commits into from
Feb 26, 2019
4 changes: 2 additions & 2 deletions assets/stylesheets/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@

@mixin square-style__focus() {
color: $dark-gray-900;
outline: 1px solid $dark-gray-300;
box-shadow: none;
outline-offset: -1px;
outline: 1px dotted $dark-gray-500;
}

// Menu items.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
.edit-post-sidebar__panel-tab {
background: transparent;
border: none;
border-radius: 0;
box-shadow: none;
cursor: pointer;
height: $grid-size * 6;
padding: 3px 15px; // Use padding to offset the is-active border, this benefits Windows High Contrast mode
margin-left: 0;
font-weight: 400;
color: $dark-gray-900;
@include square-style__neutral;
transition: box-shadow 0.1s linear;

// This pseudo-element "duplicates" the tab label and sets the text to bold.
// This ensures that the tab doesn't change width when selected.
Expand All @@ -41,9 +41,20 @@
}

&.is-active {
padding-bottom: 0;
border-bottom: 3px solid theme(primary);
box-shadow: inset 0 -3px theme(outlines);
font-weight: 600;
position: relative;

// This border appears in Windows High Contrast mode instead of the box-shadow.
&::before {
content: "";
position: absolute;
top: 0;
bottom: 1px;
right: 0;
left: 0;
border-bottom: 3px solid transparent;
}
}

&:focus {
Expand Down
18 changes: 15 additions & 3 deletions packages/edit-post/src/components/sidebar/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,30 @@
.edit-post-sidebar__panel-tab {
background: transparent;
border: none;
border-radius: 0;
box-shadow: none;
cursor: pointer;
height: 50px;
padding: 3px 15px; // Use padding to offset the is-active border, this benefits Windows High Contrast mode
margin-left: 0;
font-weight: 400;
@include square-style__neutral;
transition: box-shadow 0.1s linear;

&.is-active {
padding-bottom: 0;
border-bottom: 3px solid theme(primary);
box-shadow: inset 0 -3px theme(outlines);
font-weight: 600;
position: relative;

// This border appears in Windows High Contrast mode instead of the box-shadow.
&::before {
content: "";
position: absolute;
top: 0;
bottom: 1px;
right: 0;
left: 0;
border-bottom: 3px solid transparent;
}
}

&:focus {
Expand Down