Add :focus styles
This commit is contained in:
parent
84f365b307
commit
11d2a8bf24
@ -186,6 +186,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__image {
|
&__image {
|
||||||
|
--focus-offset: 2px;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--placeholder-background);
|
background: var(--placeholder-background);
|
||||||
border-radius: var(--layout-border-radius-small);
|
border-radius: var(--layout-border-radius-small);
|
||||||
@ -273,6 +274,10 @@
|
|||||||
padding: 2px 4px 2px 0;
|
padding: 2px 4px 2px 0;
|
||||||
border-radius: var(--layout-border-radius-small);
|
border-radius: var(--layout-border-radius-small);
|
||||||
min-width: 0; // Fix whitespace nowrap issue
|
min-width: 0; // Fix whitespace nowrap issue
|
||||||
|
|
||||||
|
a:focus-visible {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.card__left {
|
.card__left {
|
||||||
|
@ -86,6 +86,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.main-navigation {
|
.main-navigation {
|
||||||
|
--focus-border-radius: 0;
|
||||||
|
--focus-offset: -2px;
|
||||||
position: sticky;
|
position: sticky;
|
||||||
top: -1px;
|
top: -1px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
@ -184,7 +186,7 @@
|
|||||||
height: fit-content;
|
height: fit-content;
|
||||||
transition: background-color .1s;
|
transition: background-color .1s;
|
||||||
|
|
||||||
&:not(:hover) {
|
&:not(:hover, :focus-within) {
|
||||||
.sub-menu {
|
.sub-menu {
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
gap: 3px;
|
gap: 3px;
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
|
--focus-offset: -2px;
|
||||||
@extend %button;
|
@extend %button;
|
||||||
background: var(--pagination-background);
|
background: var(--pagination-background);
|
||||||
color: var(--pagination-text);
|
color: var(--pagination-text);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
gap: 16px get_clamp(12, 16, 320, 480);
|
gap: 16px get_clamp(12, 16, 320, 480);
|
||||||
|
|
||||||
> * {
|
> * {
|
||||||
|
--focus-offset: 1px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
display: block;
|
display: block;
|
||||||
color: var(--media-button-color);
|
color: var(--media-button-color);
|
||||||
@ -12,7 +13,8 @@
|
|||||||
transition: opacity var(--transition-duration), color var(--transition-duration);
|
transition: opacity var(--transition-duration), color var(--transition-duration);
|
||||||
height: get_clamp(22, 24, 320, 480);
|
height: get_clamp(22, 24, 320, 480);
|
||||||
|
|
||||||
&:hover {
|
&:hover,
|
||||||
|
&:focus-visible {
|
||||||
color: var(--media-button-color-hover);
|
color: var(--media-button-color-hover);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
@ -425,7 +425,7 @@
|
|||||||
border-radius: var(--layout-border-radius-small);
|
border-radius: var(--layout-border-radius-small);
|
||||||
padding: .75rem;
|
padding: .75rem;
|
||||||
|
|
||||||
&:not(:hover) {
|
&:not(:hover, :focus-within) {
|
||||||
.hide-unless-hover-on-desktop {
|
.hide-unless-hover-on-desktop {
|
||||||
@include bp(desktop) {
|
@include bp(desktop) {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
@ -447,9 +447,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
&__author {
|
&__author {
|
||||||
|
--focus-offset: -2px;
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
line-height: 1.2;
|
line-height: 1.2;
|
||||||
padding-top: 1px;
|
padding-top: 2px;
|
||||||
margin-bottom: 2px;
|
margin-bottom: 2px;
|
||||||
|
|
||||||
> :is(span, a) {
|
> :is(span, a) {
|
||||||
@ -641,7 +642,13 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 12px;
|
gap: 8px;
|
||||||
|
margin-right: -2px;
|
||||||
|
|
||||||
|
> * {
|
||||||
|
padding-left: 2px;
|
||||||
|
padding-right: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
@include bp(desktop) {
|
@include bp(desktop) {
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
@ -655,7 +662,7 @@
|
|||||||
color: var(--comment-button-color);
|
color: var(--comment-button-color);
|
||||||
transition: opacity var(--transition-duration);
|
transition: opacity var(--transition-duration);
|
||||||
|
|
||||||
&:not(:hover) {
|
&:not(:hover, :focus-visible) {
|
||||||
opacity: .2;
|
opacity: .2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -690,7 +697,7 @@
|
|||||||
color: var(--comment-button-color);
|
color: var(--comment-button-color);
|
||||||
transition: opacity var(--transition-duration);
|
transition: opacity var(--transition-duration);
|
||||||
|
|
||||||
&:not(:hover, .on) {
|
&:not(:hover, :focus-visible, .on) {
|
||||||
opacity: .2;
|
opacity: .2;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -704,7 +711,7 @@
|
|||||||
color: var(--comment-button-color);
|
color: var(--comment-button-color);
|
||||||
transition: opacity var(--transition-duration);
|
transition: opacity var(--transition-duration);
|
||||||
|
|
||||||
&:not(:hover, .last-clicked) {
|
&:not(:hover, :focus-visible, .last-clicked) {
|
||||||
opacity: .2;
|
opacity: .2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,9 +172,11 @@ button[type=submit] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
.button {
|
||||||
|
--focus-offset: 2px;
|
||||||
@extend %button;
|
@extend %button;
|
||||||
|
|
||||||
&._secondary {
|
&._secondary {
|
||||||
|
--focus-offset: -2px;
|
||||||
background: var(--button-secondary-background);
|
background: var(--button-secondary-background);
|
||||||
color: var(--button-secondary-text);
|
color: var(--button-secondary-text);
|
||||||
border: var(--button-secondary-border);
|
border: var(--button-secondary-border);
|
||||||
@ -272,6 +274,7 @@ button[type=submit] {
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&:not(._inline) {
|
&:not(._inline) {
|
||||||
|
--focus-offset: -2px;
|
||||||
display: block;
|
display: block;
|
||||||
background: var(--tag-background);
|
background: var(--tag-background);
|
||||||
color: var(--tag-text);
|
color: var(--tag-text);
|
||||||
@ -425,6 +428,7 @@ button[type=submit] {
|
|||||||
.popup-menu {
|
.popup-menu {
|
||||||
--translateX: translateX(0);
|
--translateX: translateX(0);
|
||||||
--translateY: translateY(0);
|
--translateY: translateY(0);
|
||||||
|
--focus-offset: -2px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background: var(--popup-menu-background);
|
background: var(--popup-menu-background);
|
||||||
color: var(--tooltip-text);
|
color: var(--tooltip-text);
|
||||||
|
@ -538,6 +538,7 @@ figure {
|
|||||||
// =============================================================================
|
// =============================================================================
|
||||||
|
|
||||||
.wp-block-file {
|
.wp-block-file {
|
||||||
|
--focus-offset: 2px;
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 0 1px;
|
gap: 0 1px;
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
@ -548,6 +549,12 @@ figure {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
|
a:focus-visible {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
&-wrapper {
|
&-wrapper {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
||||||
|
@ -10,13 +10,10 @@
|
|||||||
font-family: var(--font-base);
|
font-family: var(--font-base);
|
||||||
font-weight: var(--font-weight-normal);
|
font-weight: var(--font-weight-normal);
|
||||||
border-style: solid;
|
border-style: solid;
|
||||||
|
|
||||||
&:focus {
|
|
||||||
outline: 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
--focus-offset: -2px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-family: var(--font-base);
|
font-family: var(--font-base);
|
||||||
|
|
||||||
@ -104,6 +101,7 @@ select {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input[type=range] {
|
input[type=range] {
|
||||||
|
--focus-offset: -2px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -154,6 +152,7 @@ input[type=number] {
|
|||||||
|
|
||||||
input[type=checkbox],
|
input[type=checkbox],
|
||||||
input[type=radio] {
|
input[type=radio] {
|
||||||
|
--focus-offset: 2px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
background: var(--input-background);
|
background: var(--input-background);
|
||||||
@ -184,6 +183,7 @@ input[type=checkbox] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input[type=radio] {
|
input[type=radio] {
|
||||||
|
--focus-border-radius: 50%;
|
||||||
border-radius: 50%;
|
border-radius: 50%;
|
||||||
|
|
||||||
&:checked {
|
&:checked {
|
||||||
|
@ -162,9 +162,9 @@
|
|||||||
--code-background-inline: rgb(0 0 0 / 15%);
|
--code-background-inline: rgb(0 0 0 / 15%);
|
||||||
--code-color: var(--fg-800);
|
--code-color: var(--fg-800);
|
||||||
--warning: #f66055;
|
--warning: #f66055;
|
||||||
--warning-caption: white;
|
--warning-caption: #fff;
|
||||||
--success: #7ebb4e;
|
--success: #7ebb4e;
|
||||||
--success-caption: white;
|
--success-caption: #fff;
|
||||||
--invert-filter: invert(0);
|
--invert-filter: invert(0);
|
||||||
--red: #ef4d4d;
|
--red: #ef4d4d;
|
||||||
--litrpg-bg: var(--fg-400);
|
--litrpg-bg: var(--fg-400);
|
||||||
@ -175,6 +175,10 @@
|
|||||||
--lit-rpg-polygon: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
|
--lit-rpg-polygon: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
|
||||||
--paragraph-spacing: 1.5rem; // Fallback if not defined deeper
|
--paragraph-spacing: 1.5rem; // Fallback if not defined deeper
|
||||||
|
|
||||||
|
// === FOCUS =================================================================
|
||||||
|
--focus-background: var(--red);
|
||||||
|
--focus-outline: 2px solid var(--focus-background);
|
||||||
|
|
||||||
// === ELEVATIONS ============================================================
|
// === ELEVATIONS ============================================================
|
||||||
--e-body: var(--bg-1000);
|
--e-body: var(--bg-1000);
|
||||||
--e-fullscreen: var(--e-1);
|
--e-fullscreen: var(--e-1);
|
||||||
|
@ -9,6 +9,26 @@ html:is(:root) {
|
|||||||
-webkit-tap-highlight-color: transparent;
|
-webkit-tap-highlight-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:focus {
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
*:not(input, textarea, .wp-block-file a):focus-visible,
|
||||||
|
input:is([type=checkbox], [type=radio], [type=range]):focus-visible,
|
||||||
|
.button:focus-visible,
|
||||||
|
.card__link-list li:focus-within {
|
||||||
|
border-radius: var(--focus-border-radius, var(--layout-border-radius-small));
|
||||||
|
outline: var(--focus-outline);
|
||||||
|
outline-offset: var(--focus-offset, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Split off for browsers without support
|
||||||
|
.wp-block-file:has(a:focus-visible) {
|
||||||
|
border-radius: var(--focus-border-radius, var(--layout-border-radius-small));
|
||||||
|
outline: var(--focus-outline);
|
||||||
|
outline-offset: var(--focus-offset, 0);
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: {
|
background: {
|
||||||
color: var(--e-body);
|
color: var(--e-body);
|
||||||
|
@ -70,6 +70,7 @@ body:not(.is-editor):not(.is-admin) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.truncate {
|
.truncate {
|
||||||
|
--focus-offset: -2px;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 1;
|
-webkit-line-clamp: 1;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user