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

[Lens] Focus Fixes for v8 Theme #106634

Merged
merged 8 commits into from
Jul 30, 2021
42 changes: 42 additions & 0 deletions x-pack/plugins/lens/public/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,45 @@
@mixin lnsDroppableNotAllowed {
opacity: .5;
}

// Removes EUI focus ring
@mixin removeEuiFocusRing {
@include kbnThemeStyle('v7') {
animation: none !important; // sass-lint:disable-line no-important
}

@include kbnThemeStyle('v8') {
outline: none;

&:focus-visible {
outline-style: none;
}
}
}

// Passes focus ring styles down to a child of a focused element
@mixin passDownFocusRing($target) {
@include removeEuiFocusRing;

#{$target} {
@include euiFocusBackground;

@include kbnThemeStyle('v7') {
@include euiFocusRing;
}

@include kbnThemeStyle('v8') {
outline: $euiFocusRingSize solid currentColor; // Safari & Firefox
}
}

@include kbnThemeStyle('v8') {
&:focus-visible #{$target} {
outline-style: auto; // Chrome
}

&:not(:focus-visible) #{$target} {
outline: none;
}
}
}
11 changes: 10 additions & 1 deletion x-pack/plugins/lens/public/drag_drop/drag_drop.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@
transform: translate(-12px, 8px);
z-index: $lnsZLevel3;
pointer-events: none;
box-shadow: 0 0 0 $euiFocusRingSize $euiFocusRingColor;

@include kbnThemeStyle('v7') {
box-shadow: 0 0 0 $euiFocusRingSize $euiFocusRingColor;
}

@include kbnThemeStyle('v8') {
outline: $euiFocusRingSize solid currentColor; // Safari & Firefox
outline-style: auto; // Chrome
}
}

// Draggable item
Expand Down Expand Up @@ -133,6 +141,7 @@
&:focus-within {
@include euiFocusRing;
pointer-events: none;
z-index: $lnsZLevel2;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../../mixins';

.lnsLayerPanel {
margin-bottom: $euiSizeS;

Expand Down Expand Up @@ -132,12 +134,7 @@
width: 100%;

&:focus {
@include passDownFocusRing('.lnsLayerPanel__triggerTextLabel');
background-color: transparent;
animation: none !important; // sass-lint:disable-line no-important
}

&:focus .lnsLayerPanel__triggerTextLabel,
&:focus-within .lnsLayerPanel__triggerTextLabel {
background-color: transparentize($euiColorVis1, .9);
}
}
37 changes: 18 additions & 19 deletions x-pack/plugins/lens/public/indexpattern_datasource/field_item.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
@import '../mixins';

.lnsFieldItem {
width: 100%;

&.kbnFieldButton {
&:focus-within,
&-isActive {
@include removeEuiFocusRing;
}
}

.kbnFieldButton__button:focus {
@include passDownFocusRing('.kbnFieldButton__name > span');

.kbnFieldButton__name > span {
text-decoration: underline;
}
}

.lnsFieldItem__infoIcon {
visibility: hidden;
opacity: 0;
Expand All @@ -14,25 +32,6 @@
transition: opacity $euiAnimSpeedFast ease-in-out 1s;
}
}

&:focus,
&:focus-within,
.kbnFieldButton__button:focus:focus-visible,
&.kbnFieldButton-isActive {
@include kbnThemeStyle('v7') {
animation: none !important; // sass-lint:disable-line no-important
}
@include kbnThemeStyle('v8') {
outline: none !important; // sass-lint:disable-line no-important
}
}

&:focus .kbnFieldButton__name span,
&:focus-within .kbnFieldButton__name span,
&.kbnFieldButton-isActive .kbnFieldButton__name span {
background-color: transparentize($euiColorVis1, .9) !important;
text-decoration: underline !important;
}
}

.kbnFieldButton.lnsDragDrop_ghost {
Expand Down