Skip to content

Commit

Permalink
fix: couple css improvements for webkit-based browsers
Browse files Browse the repository at this point in the history
introduces a new mixin to handle webkit-based shenanigans.
also adds a mixin to make keyboard navigation easier.
and other small tweaks to css(like accent color and color scheme).
  • Loading branch information
zyachel committed Dec 31, 2022
1 parent 57b050f commit 81eaf2f
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 2 deletions.
18 changes: 18 additions & 0 deletions src/styles/abstracts/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,21 @@
background-size: 100% $height;
}
}

////////////////////////////////////////////////////////////////
// CHECK IF BROWSER IS SAFARI(it's the new IE)
////////////////////////////////////////////////////////////////

@mixin fix-for-safari {
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
@content;
}
}

////////////////////////////////////////////////////////////////
//
////////////////////////////////////////////////////////////////
@mixin focus-rules {
outline: 3px solid var(--clr-highlight);
outline-offset: 0.2em;
}
5 changes: 4 additions & 1 deletion src/styles/abstracts/variables/_themes.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ $_light: (
transparent 70%
),
radial-gradient(at 72% 55%, hsla(344, 79%, 40%, 0.2) 0px, transparent 50%)
)
),
// changes color of native html elemnts, either 'light' or 'dark' must be set.
scheme: light
);

$_dark: (
Expand All @@ -54,6 +56,7 @@ $_dark: (
radial-gradient(at 23% 32%, hsla(344, 79%, 40%, 0.04) 0px, transparent 70%),
radial-gradient(at 72% 55%, hsla(344, 79%, 40%, 0.05) 0px, transparent 50%),
),
scheme: dark,
);

$themes: (
Expand Down
23 changes: 23 additions & 0 deletions src/styles/base/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ body {
#__next {
display: grid;
grid-template-rows: min-content 1fr min-content;

&:has(span[role='progressbar']) {
cursor: progress;
}
}

body {
color: var(--clr-text);
background-color: var(--clr-bg);
color-scheme: var(--clr-scheme);
accent-color: var(--clr-fill);
}

// restricting to 1600px width
Expand All @@ -22,3 +28,20 @@ body {
width: min(100%, var(--max-width));
margin-inline: auto;
}

////////////////////////////////////////////////////////
// KEYBOARD NAVIGATION
////////////////////////////////////////////////////////
:focus {
@include helper.focus-rules;
}

@supports selector(:focus-visible) {
:focus {
outline: none;
}

:focus-visible {
@include helper.focus-rules;
}
}
2 changes: 1 addition & 1 deletion src/styles/base/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@forward './reset';
// @forward './helpers';
@forward './helpers';
@forward './root';
@forward './base';
@forward './fonts';
Expand Down
5 changes: 5 additions & 0 deletions src/styles/base/_root.scss
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@
@include helper.bp('bp-700') {
@include helper.typescale('mobile');
}

// not using any external fonts on webkit because of many issues
@include helper.fix-for-safari {
--ff-accent: var(--ff-base);
}
}
5 changes: 5 additions & 0 deletions src/styles/modules/pages/about/about.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@
content: '+';
font-weight: bold;
}

// fix for webkit(not including blink)
&::-webkit-details-marker {
display: none;
}
}

&__description {
Expand Down

0 comments on commit 81eaf2f

Please sign in to comment.