Skip to content

Commit

Permalink
update checkboxes to not glitch in webkit
Browse files Browse the repository at this point in the history
  • Loading branch information
KTibow committed Aug 6, 2024
1 parent 47c831d commit 9ddeb23
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
26 changes: 13 additions & 13 deletions src/lib/forms/Checkbox.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@

<div class="m3-container" style="display: {display};" {...extraOptions}>
<slot />
<div class="layer">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M 4.83 13.41 L 9 17.585 L 19.59 7"
fill="none"
stroke="currentColor"
stroke-width="1.41"
/>
</svg>
</div>
<div class="layer" />
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M 4.83 13.41 L 9 17.585 L 19.59 7"
fill="none"
stroke="currentColor"
stroke-width="1.41"
/>
</svg>
</div>

<style>
Expand Down Expand Up @@ -53,9 +52,10 @@
}
svg {
position: absolute;
inset: 0.6875rem;
inset: 0;
color: rgb(var(--m3-scheme-on-primary));
opacity: 0;
pointer-events: none;
transition: opacity 200ms;
}
Expand All @@ -76,7 +76,7 @@
:global(input:checked) + .layer::before {
background-color: rgb(var(--color));
}
:global(input:checked) + .layer svg {
:global(input:checked) ~ svg {
opacity: 1;
}
Expand All @@ -85,7 +85,7 @@
--color: var(--m3-scheme-on-surface) / 0.38;
pointer-events: none;
}
:global(input:disabled) + .layer svg {
:global(input:disabled) ~ svg {
color: rgb(var(--m3-scheme-surface));
}
:global(input:disabled:checked) + .layer::before {
Expand Down
26 changes: 13 additions & 13 deletions src/lib/forms/CheckboxAnim.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@

<div class="m3-container" style="display: {display};" {...extraOptions}>
<slot />
<div class="layer">
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M 4.83 13.41 L 9 17.585 L 19.59 7"
fill="none"
stroke="currentColor"
stroke-width="1.41"
/>
</svg>
</div>
<div class="layer" />
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path
d="M 4.83 13.41 L 9 17.585 L 19.59 7"
fill="none"
stroke="currentColor"
stroke-width="1.41"
/>
</svg>
</div>

<style>
Expand Down Expand Up @@ -53,8 +52,9 @@
}
svg {
position: absolute;
inset: 0.6875rem;
inset: 0;
color: rgb(var(--m3-scheme-on-primary));
pointer-events: none;
}
path {
stroke-dasharray: 20.874 20.874;
Expand Down Expand Up @@ -82,7 +82,7 @@
:global(input:checked) + .layer::before {
background-color: rgb(var(--color));
}
:global(input:checked) + .layer path {
:global(input:checked) ~ svg > path {
stroke-dashoffset: 0;
opacity: 1;
transition: stroke-dashoffset 200ms;
Expand All @@ -93,7 +93,7 @@
--color: var(--m3-scheme-on-surface) / 0.38;
pointer-events: none;
}
:global(input:disabled) + .layer svg {
:global(input:disabled) ~ svg {
color: rgb(var(--m3-scheme-surface));
}
:global(input:disabled:checked) + .layer::before {
Expand Down

0 comments on commit 9ddeb23

Please sign in to comment.