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 toggles. #18860

Closed
wants to merge 1 commit into from
Closed
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
65 changes: 65 additions & 0 deletions packages/components/src/toolbar-button/style.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
.components-toolbar__control.components-button {
display: inline-flex;
align-items: flex-end;
margin: 0;
padding: 3px;
outline: none;
cursor: pointer;
position: relative;
width: $icon-button-size;
height: $icon-button-size;

// Unset icon button styles
&:not([aria-disabled="true"]):not(.is-default):active,
&:not([aria-disabled="true"]):hover,
&:not([aria-disabled="true"]):focus {
outline: none;
box-shadow: none;
background: none;
border: none;
}

// Disabled
&:disabled {
cursor: default;
}

& > svg {
padding: 5px;
border-radius: $radius-round-rectangle;
height: 30px;
width: 30px;
box-sizing: border-box;
}

// Subscript for numbered icon buttons, like headings
&[data-subscript] svg {
padding: 5px 10px 5px 0;
Expand All @@ -21,4 +51,39 @@
&:not(:disabled).is-active[data-subscript]::after {
color: $white;
}


// Assign hover style to child element, not the button itself
&:not(:disabled):not([aria-disabled="true"]):hover {
box-shadow: none;
}

&:not(:disabled).is-active > svg,
&:not(:disabled):hover > svg {
@include formatting-button-style__hover;
}

// Active & toggled style
&:not(:disabled).is-active > svg {
@include formatting-button-style__active;
}

// Focus style
&:not(:disabled):focus > svg {
@include formatting-button-style__focus;
// Remove outline from SVG to apply on focused element - see below.
outline: 0;
}

// Microsoft Edge in high contrast mode only displays outlines on focused elements, not their children.
&:not(:disabled).is-active {
outline: 1px dotted transparent;
outline-offset: -2px;
}

// Microsoft Edge in high contrast mode only displays outlines on focused elements, not their children.
&:not(:disabled):focus {
outline: 2px solid transparent;
}

}