[improvement] NumberKeyboard: improve accessibility

This commit is contained in:
陈嘉涵
2019-05-25 16:33:35 +08:00
parent 2c275fd98b
commit 1821889f01
16 changed files with 85 additions and 81 deletions

View File

@@ -1,5 +1,4 @@
import { use } from '../utils';
import { preventDefault } from '../utils/event';
const [sfc, bem] = use('key');
@@ -26,12 +25,14 @@ export default sfc({
methods: {
onFocus() {
this.active = true;
this.$emit('press', this.text);
},
onBlur(event) {
preventDefault(event, true);
this.active = false;
},
onClick() {
this.$emit('press', this.text);
}
},
@@ -39,7 +40,10 @@ export default sfc({
const { onBlur } = this;
return (
<i
role="button"
tabindex="0"
class={['van-hairline', this.className]}
onClick={this.onClick}
onTouchstart={this.onFocus}
onTouchmove={onBlur}
onTouchend={onBlur}