mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved accessibility of material-design checkbox
This commit is contained in:
parent
e148cdea75
commit
d0376b53a8
5 changed files with 16 additions and 8 deletions
|
|
@ -1,5 +1,7 @@
|
||||||
export class CheckboxComponent {
|
export class CheckboxComponent {
|
||||||
constructor(params = {}) {
|
constructor(params = {}) {
|
||||||
|
this.name = params.name;
|
||||||
|
|
||||||
this.value = ko.isObservable(params.value) ? params.value
|
this.value = ko.isObservable(params.value) ? params.value
|
||||||
: ko.observable(!!params.value);
|
: ko.observable(!!params.value);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,7 +57,12 @@
|
||||||
margin-bottom: 6px;
|
margin-bottom: 6px;
|
||||||
padding: 2px 0;
|
padding: 2px 0;
|
||||||
|
|
||||||
&:focus {
|
input {
|
||||||
|
opacity:0;
|
||||||
|
position:absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus-within {
|
||||||
outline: 1px dotted;
|
outline: 1px dotted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -70,6 +75,7 @@
|
||||||
.e-checkbox.material-design {
|
.e-checkbox.material-design {
|
||||||
|
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
|
width: auto !important;
|
||||||
|
|
||||||
> div {
|
> div {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -85,7 +91,7 @@
|
||||||
animation: checkmark-to-box 200ms ease-out forwards;
|
animation: checkmark-to-box 200ms ease-out forwards;
|
||||||
}
|
}
|
||||||
|
|
||||||
div.checked {
|
input:checked + div div {
|
||||||
.checkbox-mark-sizes();
|
.checkbox-mark-sizes();
|
||||||
animation: box-to-checkmark 200ms ease-out forwards;
|
animation: box-to-checkmark 200ms ease-out forwards;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
<div class="e-component e-checkbox material-design" tabindex="0" data-bind="click: click, onSpace: click, css: { 'disabled': !enable() }">
|
<label class="e-component e-checkbox material-design" data-bind="css: { 'disabled': !enable() }">
|
||||||
<div role="checkbox">
|
<input type="checkbox" data-bind="checked: value, enable: enable, attr: {name: name}"/>
|
||||||
<div data-bind="css: {'checked': value()}"></div>
|
<div role="checkbox"><div></div></div>
|
||||||
</div>
|
|
||||||
<!-- ko if: label -->
|
<!-- ko if: label -->
|
||||||
<span data-bind="attr: {'data-i18n': label}"></span>
|
<span data-bind="attr: {'data-i18n': label}"></span>
|
||||||
<!-- /ko -->
|
<!-- /ko -->
|
||||||
</div>
|
</label>
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
<div class="control-group" data-bind="component: {
|
<div class="control-group" data-bind="component: {
|
||||||
name: 'Checkbox',
|
name: 'Checkbox',
|
||||||
params: {
|
params: {
|
||||||
|
name: 'subscribe',
|
||||||
label: 'SETTINGS_FOLDERS/BUTTON_SUBSCRIBE',
|
label: 'SETTINGS_FOLDERS/BUTTON_SUBSCRIBE',
|
||||||
value: folderSubscribe
|
value: folderSubscribe
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
vendors/bootstrap/less/forms.less
vendored
2
vendors/bootstrap/less/forms.less
vendored
|
|
@ -13,7 +13,7 @@ form {
|
||||||
|
|
||||||
// Identify controls by their labels
|
// Identify controls by their labels
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: inline-block;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
line-height: 1.43em;
|
line-height: 1.43em;
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue