Merge pull request #2847 from Xotic750/radio_tabindex

Radio: Tabindex WIP
This commit is contained in:
Aresn 2018-01-19 10:24:09 +08:00 committed by GitHub
commit a43f9d7ceb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 5 deletions

View file

@ -1,14 +1,19 @@
<template> <template>
<label :class="wrapClasses"> <label
:class="wrapClasses"
:tabindex="disabled ? -1 : 0"
@keyup.space="change">
<span :class="radioClasses"> <span :class="radioClasses">
<span :class="innerClasses"></span> <span :class="innerClasses"></span>
<input <input
type="radio" type="radio"
tabindex="-1"
:class="inputClasses" :class="inputClasses"
:disabled="disabled" :disabled="disabled"
:checked="currentValue" :checked="currentValue"
:name="name" :name="name"
@change="change"> @change="change"
>
</span><slot>{{ label }}</slot> </span><slot>{{ label }}</slot>
</label> </label>
</template> </template>

View file

@ -16,7 +16,7 @@
} }
} }
// 普通状态 // 普通状态 - Normal state
.@{radio-prefix-cls}-wrapper { .@{radio-prefix-cls}-wrapper {
font-size: @font-size-small; font-size: @font-size-small;
vertical-align: middle; vertical-align: middle;
@ -28,6 +28,12 @@
&-disabled{ &-disabled{
cursor: @cursor-disabled; cursor: @cursor-disabled;
} }
outline: 0;
&:focus {
& .@{radio-inner-prefix-cls} {
box-shadow: 0 0 0 2px fade(@primary-color, 20%);
}
}
} }
.@{radio-prefix-cls} { .@{radio-prefix-cls} {
@ -110,7 +116,7 @@
} }
} }
// 选中状态 // 选中状态 - Selected state
.@{radio-prefix-cls}-checked { .@{radio-prefix-cls}-checked {
.@{radio-inner-prefix-cls} { .@{radio-inner-prefix-cls} {
border-color: @primary-color; border-color: @primary-color;
@ -156,7 +162,7 @@ span.@{radio-prefix-cls} + * {
margin-right: 2px; margin-right: 2px;
} }
// 按钮样式 // 按钮样式 - Button style
.@{radio-group-button-prefix-cls} { .@{radio-group-button-prefix-cls} {
font-size: 0; font-size: 0;
-webkit-text-size-adjust:none; -webkit-text-size-adjust:none;
@ -214,6 +220,13 @@ span.@{radio-prefix-cls} + * {
&:hover { &:hover {
position: relative; position: relative;
color: @primary-color; color: @primary-color;
& .@{radio-prefix-cls} {
background-color: black;
}
}
&:focus {
box-shadow: 0 0 0 2px fade(@primary-color, 20%);
} }
.@{radio-prefix-cls}-inner, .@{radio-prefix-cls}-inner,
@ -240,6 +253,10 @@ span.@{radio-prefix-cls} + * {
color: tint(@primary-color, 20%); color: tint(@primary-color, 20%);
} }
&:focus {
box-shadow: 0 0 0 2px fade(@primary-color, 20%)!important;
}
&:active { &:active {
border-color: shade(@primary-color, 5%); border-color: shade(@primary-color, 5%);
box-shadow: -1px 0 0 0 shade(@primary-color, 5%); box-shadow: -1px 0 0 0 shade(@primary-color, 5%);
@ -291,3 +308,4 @@ span.@{radio-prefix-cls} + * {
border-radius: 0 @btn-border-radius-small @btn-border-radius-small 0; border-radius: 0 @btn-border-radius-small @btn-border-radius-small 0;
} }
} }