[Lens] Focus Fixes for v8 Theme (#106634)

* set correct focus ring for each theme

* fix field and dimension button span faux focus

* fix dimension button focus

* add mixin to remove euiFocusRing

* clean up the mess

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Michael Marcialis 2021-07-30 03:27:58 -04:00 committed by GitHub
parent 6da99f33e8
commit 4317dcb43d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 73 additions and 26 deletions

View file

@ -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;
}
}
}

View file

@ -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
@ -133,6 +141,7 @@
&:focus-within {
@include euiFocusRing;
pointer-events: none;
z-index: $lnsZLevel2;
}
}

View file

@ -1,3 +1,5 @@
@import '../../../mixins';
.lnsLayerPanel {
margin-bottom: $euiSizeS;
@ -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);
}
}

View file

@ -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;
@ -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 {