Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drop checkbox label hacks in favor of -moz-appearance
Fixes #59
- Loading branch information
Showing
3 changed files
with
42 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,63 +1,45 @@ | |||
.checkbox { | input[type="checkbox"] { | ||
position: relative; | -moz-appearance: none; | ||
|
-webkit-appearance: none; | ||
/* TODO: Figure out if inline-block and 100% width the right thing for | background-color: var(--grey-90-a10); | ||
providing consistent click target */ | border-radius: 2px; | ||
display: inline-block; | border: 1px solid var(--grey-90-a30); | ||
width: 100%; | |||
} | |||
|
|||
.checkbox--disabled { | |||
opacity: .4; | |||
} | |||
|
|||
.checkbox__field { | |||
opacity: 0; | |||
padding-right: 4px; | |||
width: 16px; | |||
height: 16px; | height: 16px; | ||
margin: -2px 4px; | |||
width: 16px; | |||
} | } | ||
|
|
||
.checkbox__label::after { | input[type="checkbox"]:disabled { | ||
position: absolute; | opacity: .4; | ||
cursor: pointer; | |||
left: 2px; | |||
bottom: 2px; | |||
display: inline-block; | |||
width: 16px; | |||
height: 16px; | |||
border-radius: 2px; | |||
margin-left: 0; | |||
margin-right: 0; | |||
content: ""; | |||
background-color: var(--grey-90-a10); | |||
border: 1px solid var(--grey-90-a30); | |||
} | } | ||
|
|
||
.checkbox__label:hover::after { | input[type="checkbox"]:hover { | ||
background-color: var(--grey-90-a20); | background-color: var(--grey-90-a20); | ||
} | } | ||
|
|
||
.checkbox__label:active::after { | input[type="checkbox"]:active { | ||
background-color: var(--grey-90-a30); | background-color: var(--grey-90-a30); | ||
} | } | ||
|
|
||
.checkbox__field:focus + .checkbox__label::after { | input[type="checkbox"]:focus { | ||
border: none; | border: none; | ||
left: 3px; | |||
bottom: 3px; | |||
box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0 4px rgba(10, 132, 255, .3); | box-shadow: 0 0 0 1px #0a84ff inset, 0 0 0 1px #0a84ff, 0 0 0 4px rgba(10, 132, 255, .3); | ||
} | } | ||
|
|
||
.checkbox__field:checked + .checkbox__label::after { | input[type="checkbox"]:checked { | ||
background-color: var(--blue-60); | background-color: var(--blue-60); | ||
background-image: url(./checkbox-check-16.svg); | background-image: url(./checkbox-check-16.svg); | ||
background-position: center center; | |||
} | } | ||
|
|
||
.checkbox__field:checked + .checkbox__label:hover::after { | input[type="checkbox"]:checked:hover { | ||
background-color: var(--blue-70); | background-color: var(--blue-70); | ||
} | } | ||
|
|
||
.checkbox__field:checked + .checkbox__label:active::after { | input[type="checkbox"]:checked:active { | ||
background-color: var(--blue-80); | background-color: var(--blue-80); | ||
} | } | ||
|
|||
label.checkbox--disabled > span { | |||
opacity: .4; | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters