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(controls): Avoid showing focus styles for disabled controls #1365

Merged
merged 1 commit into from
Apr 27, 2021
Merged
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
14 changes: 7 additions & 7 deletions src/lib/viewers/controls/_styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ $bp-controls-size-small: 32px;
$bp-controls-spacing: 6px;

@mixin bp-Control($height: $bp-controls-size-default, $width: $bp-controls-size-default) {
@include bp-Control--fade;
@include bp-Control--outline;

display: flex;
align-items: center;
justify-content: center;
Expand Down Expand Up @@ -39,9 +42,6 @@ $bp-controls-spacing: 6px;
padding: 5px;
border-radius: $bp-controls-radius-inner;
}

@include bp-Control--fade;
@include bp-Control--outline;
}

@mixin bp-Control--expand {
Expand All @@ -54,20 +54,20 @@ $bp-controls-spacing: 6px;
transition: opacity 150ms;
will-change: opacity; // Prevent flickering in Safari

&:focus,
&:hover {
&:focus:not(:disabled),
&:hover:not(:disabled) {
opacity: 1;
}
}

@mixin bp-Control--outline {
outline: 0;

&:focus {
&:focus:not(:disabled) {
box-shadow: $bp-controls-outline; // Show effect for all events in legacy browsers (IE, Safari)
}

&:focus-visible {
&:focus-visible:not(:disabled) {
box-shadow: $bp-controls-outline; // Show effect for keyboard events in modern browsers
}

Expand Down