Standardize checkbox visual to material design

Motivation:
- To align with Firefox Preview's own design
- To uniformize checkbox look and behavior
  across all platforms
This commit is contained in:
Raymond Hill 2020-04-25 15:19:07 -04:00
parent 525eb9f922
commit f9b385ffb1
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
8 changed files with 108 additions and 41 deletions

View File

@ -24,10 +24,10 @@
</div>
<div>
<div class="li"><label><input type="checkbox" id="autoUpdate"><span data-i18n="3pAutoUpdatePrompt1"></span></label></div>
<div class="li"><label><input type="checkbox" id="parseCosmeticFilters"><span><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span>&nbsp;<span class="fa-icon info" data-i18n-title="3pParseAllABPHideFiltersInfo">question-circle</span></span></label>
<div class="li"><label><input type="checkbox" id="autoUpdate"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span data-i18n="3pAutoUpdatePrompt1"></span></label></div>
<div class="li"><label><input type="checkbox" id="parseCosmeticFilters"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="3pParseAllABPHideFiltersPrompt1"></span>&nbsp;<span class="fa-icon info" data-i18n-title="3pParseAllABPHideFiltersInfo">question-circle</span></span></label>
</div>
<div class="li"><label><input type="checkbox" id="ignoreGenericCosmeticFilters"><span><span data-i18n="3pIgnoreGenericCosmeticFilters"></span>&nbsp;<span class="fa-icon info" data-i18n-title="3pIgnoreGenericCosmeticFiltersInfo">question-circle</span></span></label>
<div class="li"><label><input type="checkbox" id="ignoreGenericCosmeticFilters"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="3pIgnoreGenericCosmeticFilters"></span>&nbsp;<span class="fa-icon info" data-i18n-title="3pIgnoreGenericCosmeticFiltersInfo">question-circle</span></span></label>
</div>
</div>
@ -45,7 +45,7 @@
<div class="listEntries"></div>
</div>
<div class="li listEntry">
<label><input type="checkbox"><span><span class="listname forinput"></span> <span class="iconbar"><!--
<label><input type="checkbox"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span class="listname forinput"></span> <span class="iconbar"><!--
--><a class="fa-icon content" href="#" type="text/plain" target="_blank" data-i18n-title="3pViewContent">eye-open</a><!--
--><a class="fa-icon support" href="#" target="_blank">home</a><!--
--><span class="fa-icon remove">trash-o</span><!--

View File

@ -68,7 +68,8 @@ body.hideUnused #listsOfBlockedHostsPrompt::before,
.listEntry .listname {
white-space: nowrap;
}
.listEntry.toRemove input[type="checkbox"] {
.listEntry.toRemove input[type="checkbox"],
.listEntry.toRemove .checkbox {
visibility: hidden;
}
.listEntry.toRemove .listname {
@ -198,9 +199,8 @@ body.updating .listEntry.checked.obsolete .updating {
background-color: var(--bg-1);
overflow-x: auto;
}
:root.mobile .li.listEntry label > span {
:root.mobile .li.listEntry label > span:not([class]) {
flex-grow: 1;
padding-inline-start: 0.3em;
}
:root.mobile .li.listEntry .listname,
:root.mobile .li.listEntry .iconbar {

View File

@ -42,7 +42,7 @@ body {
color: var(--default-ink);
fill: var(--default-ink);
font-family: Inter, sans-serif;
font-size: 14px;
font-size: var(--font-size);
line-height: 1.5;
margin: 0;
padding: 0;
@ -85,7 +85,7 @@ button {
justify-content: center;
letter-spacing: 0.5px;
min-height: 36px;
padding: 0 16px;
padding: 0 var(--font-size);
-moz-appearance: none;
-webkit-appearance: none;
}
@ -129,25 +129,62 @@ body[dir="rtl"] button.iconifiable > .fa,
body[dir="rtl"] button.iconifiable > .fa-icon {
padding-left: 0.5em;
}
label {
align-items: center;
display: inline-flex;
position: relative;
}
/**
Checkbox design borrowed from:
- https://material.io/components/selection-controls
Motivation:
- To comply with design suggestions to make uBO comply with
Firefox Preview design guidelines.
- To have a single checkbox design across all platforms.
*/
input[type="checkbox"] {
--margin-end: calc(var(--font-size) * 0.75);
height: var(--checkbox-size);
margin: 0;
margin-inline-end: var(--margin-end);
-webkit-margin-end: var(--margin-end);
min-width: var(--checkbox-size);
opacity: 0;
width: var(--checkbox-size);
}
input[type="checkbox"] + .checkbox {
background-color: transparent;
border: 2px solid var(--checkbox-ink);
border-radius: 2px;
box-sizing: border-box;
display: inline-flex;
height: var(--checkbox-size);
pointer-events: none;
position: absolute;
width: var(--checkbox-size);
}
input[type="checkbox"] + .checkbox > svg {
fill: none;
height: 100%;
width: 100%;
}
input[type="checkbox"]:checked + .checkbox {
background-color: var(--checkbox-checked-ink);
border-color: var(--checkbox-checked-ink);
fill: var(--checkbox-checked-ink);
stroke: var(--default-surface);
stroke-width: 3.12px;
}
.hidden {
display: none;
height: 0;
visibility: hidden;
width: 0;
}
label {
align-items: center;
display: inline-flex;
}
input[type="checkbox"] {
margin: 0;
margin-inline-start: 0.4em;
-webkit-margin-start: 0.4em;
margin-inline-end: 0.4em;
-webkit-margin-end: 0.4em;
}
.fieldset {
margin: 1em 0.5em;
margin: var(--font-size);
}
.fieldset-header {
color: var(--fieldset-header-ink);
@ -161,7 +198,7 @@ input[type="checkbox"] {
.li {
align-items: center;
display: flex;
margin: 12px 0;
margin: calc(var(--font-size) * 0.75) 0;
}
.liul {
margin: 0.5em 0;
@ -217,9 +254,6 @@ input[type="checkbox"] {
}
/* touch-screen devices */
:root.mobile body {
font-size: 16px;
}
:root.mobile label {
flex-grow: 1
}

View File

@ -39,6 +39,7 @@ html, body {
letter-spacing: 0.5px;
padding: 0.5em 1.4em calc(0.5em - 3px);
text-decoration: none;
user-select: none;
white-space: nowrap;
}
.tabButton:focus {

View File

@ -22,6 +22,7 @@
--light-gray-10: #f9f9fb;
--light-gray-30: #e0e0e6;
--light-gray-40: #cfcfd8;
--light-gray-90: #80808f;
--violet-70: #592acb;
--violet-80: #45278d;
--yellow-30: #ffd567;
@ -32,10 +33,23 @@
--white: #fff;
}
/**
Font size
*/
:root {
--font-size: 14px;
}
:root.mobile {
--font-size: 16px;
}
/**
Components
*/
:root {
--font-size: 14px;
--bg-0: var(--white);
--fg-0: var(--ink-80);
--default-ink: var(--ink-80);
@ -76,6 +90,10 @@
--button-disabled-surface: var(--light-gray-30);
--button-disabled-ink: var(--ink-20);
--checkbox-size: calc(var(--font-size) + 2px);
--checkbox-ink: var(--light-gray-90);
--checkbox-checked-ink: var(--ink-20);
--bg-transient-notice: hsla(60, 100%, 95%, 1);
--dashboard-bar-shadow:

View File

@ -0,0 +1,15 @@
<!--
The SVG definitions were imported piecemeal from:
https://material.io/components/selection-controls
License:
- https://github.com/material-components/material-components/blob/develop/LICENSE
-->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="display: none;">
<defs>
<symbol id="checkmark" viewBox="0 0 24 24"><path d="M 1.73 12.91 L 8.1 19.28 L 22.79 4.59"/></symbol>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 475 B

View File

@ -35,7 +35,6 @@ const faIconsInit = function(root) {
const use = document.createElementNS('http://www.w3.org/2000/svg', 'use');
const href = '/img/fontawesome/fontawesome-defs.svg#' + name;
use.setAttribute('href', href);
use.setAttribute('xlink:href', href);
svg.appendChild(use);
icon.replaceChild(svg, icon.firstChild);
if ( icon.classList.contains('fa-icon-badged') ) {

View File

@ -13,30 +13,30 @@
<body>
<div class="fieldset">
<div class="li"><label><input type="checkbox" data-setting-name="collapseBlocked" data-setting-type="bool"><span data-i18n="settingsCollapseBlockedPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="showIconBadge" data-setting-type="bool"><span data-i18n="settingsIconBadgePrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="contextMenuEnabled" data-setting-type="bool"><span data-i18n="settingsContextMenuPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="tooltipsDisabled" data-setting-type="bool"><span data-i18n="settingsTooltipsPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="colorBlindFriendly" data-setting-type="bool"><span data-i18n="settingsColorBlindPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="cloudStorageEnabled" data-setting-type="bool"><span><span data-i18n="settingsCloudStorageEnabledPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Cloud-storage" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="advancedUserEnabled" data-setting-type="bool"><span><span data-i18n="settingsAdvancedUserPrompt"></span>&nbsp;<a class="fa-icon info" href="advanced-settings.html" data-i18n-title="settingsAdvancedUserSettings">cogs</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="collapseBlocked" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span data-i18n="settingsCollapseBlockedPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="showIconBadge" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span data-i18n="settingsIconBadgePrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="contextMenuEnabled" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span data-i18n="settingsContextMenuPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="tooltipsDisabled" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span data-i18n="settingsTooltipsPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="colorBlindFriendly" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span data-i18n="settingsColorBlindPrompt"></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="cloudStorageEnabled" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsCloudStorageEnabledPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Cloud-storage" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="advancedUserEnabled" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsAdvancedUserPrompt"></span>&nbsp;<a class="fa-icon info" href="advanced-settings.html" data-i18n-title="settingsAdvancedUserSettings">cogs</a></span></label></div>
</div>
<hr>
<div class="fieldset">
<div class="fieldset-header" data-i18n="3pGroupPrivacy"></div>
<div class="li"><label><input type="checkbox" data-setting-name="prefetchingDisabled" data-setting-type="bool"><span><span data-i18n="settingsPrefetchingDisabledPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#disable-pre-fetching" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="hyperlinkAuditingDisabled" data-setting-type="bool"><span><span data-i18n="settingsHyperlinkAuditingDisabledPrompt"></span>&nbsp;<a class="fa-icon info important" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#disable-hyperlink-auditing" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="webrtcIPAddressHidden" data-setting-type="bool"><span><span data-i18n="settingsWebRTCIPAddressHiddenPrompt"></span>&nbsp;<a class="fa-icon info important" href="https://github.com/gorhill/uBlock/wiki/Prevent-WebRTC-from-leaking-local-IP-address" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noCSPReports" data-setting-type="bool"><span><span data-i18n="settingsNoCSPReportsPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#block-csp-reports" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="prefetchingDisabled" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsPrefetchingDisabledPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#disable-pre-fetching" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="hyperlinkAuditingDisabled" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsHyperlinkAuditingDisabledPrompt"></span>&nbsp;<a class="fa-icon info important" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#disable-hyperlink-auditing" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="webrtcIPAddressHidden" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsWebRTCIPAddressHiddenPrompt"></span>&nbsp;<a class="fa-icon info important" href="https://github.com/gorhill/uBlock/wiki/Prevent-WebRTC-from-leaking-local-IP-address" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noCSPReports" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsNoCSPReportsPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Dashboard:-Settings#block-csp-reports" target="_blank">info-circle</a></span></label></div>
</div>
<hr>
<div class="fieldset">
<div class="fieldset-header" data-i18n="settingPerSiteSwitchGroup"></div>
<div class="li synopsis"><legend><span data-i18n="settingPerSiteSwitchGroupSynopsis"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches" target="_blank">info-circle</a></legend></div>
<div class="li"><label><input type="checkbox" data-setting-name="noCosmeticFiltering" data-setting-type="bool"><span><span data-i18n="settingsNoCosmeticFilteringPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-cosmetic-filtering" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noLargeMedia" data-setting-type="bool"><span><span data-i18n="settingsNoLargeMediaPrompt"><input type="number" min="0"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-large-media-elements" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noRemoteFonts" data-setting-type="bool"><span><span data-i18n="settingsNoRemoteFontsPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-remote-fonts" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noScripting" data-setting-type="bool"><span><span data-i18n="settingsNoScriptingPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-scripting" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noCosmeticFiltering" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsNoCosmeticFilteringPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-cosmetic-filtering" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noLargeMedia" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsNoLargeMediaPrompt"><input type="number" min="0"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-large-media-elements" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noRemoteFonts" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsNoRemoteFontsPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-remote-fonts" target="_blank">info-circle</a></span></label></div>
<div class="li"><label><input type="checkbox" data-setting-name="noScripting" data-setting-type="bool"><span class="checkbox"><svg><use href="img/material-design.svg#checkmark" /></svg></span><span><span data-i18n="settingsNoScriptingPrompt"></span>&nbsp;<a class="fa-icon info" href="https://github.com/gorhill/uBlock/wiki/Per-site-switches#no-scripting" target="_blank">info-circle</a></span></label></div>
</div>
<hr>
<div id="localData" class="fieldset">