mirror of https://github.com/ElemeFE/element
Tooltip: fix custom tabindex not work (#15619)
parent
8933a057f2
commit
c27788f993
|
@ -110,7 +110,7 @@ export default {
|
||||||
this.referenceElm = this.$el;
|
this.referenceElm = this.$el;
|
||||||
if (this.$el.nodeType === 1) {
|
if (this.$el.nodeType === 1) {
|
||||||
this.$el.setAttribute('aria-describedby', this.tooltipId);
|
this.$el.setAttribute('aria-describedby', this.tooltipId);
|
||||||
this.$el.setAttribute('tabindex', 0);
|
this.$el.setAttribute('tabindex', this.tabindex);
|
||||||
on(this.referenceElm, 'mouseenter', this.show);
|
on(this.referenceElm, 'mouseenter', this.show);
|
||||||
on(this.referenceElm, 'mouseleave', this.hide);
|
on(this.referenceElm, 'mouseleave', this.hide);
|
||||||
on(this.referenceElm, 'focus', () => {
|
on(this.referenceElm, 'focus', () => {
|
||||||
|
|
|
@ -153,4 +153,12 @@ describe('Tooltip', () => {
|
||||||
}, 100);
|
}, 100);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
it('custom tabindex', () => {
|
||||||
|
vm = createVue(`
|
||||||
|
<el-tooltip ref="tooltip" content="提示文字" :tabindex="-1">
|
||||||
|
<button>click</button>
|
||||||
|
</el-tooltip>
|
||||||
|
`, true);
|
||||||
|
expect(vm.$el.getAttribute('tabindex')).to.be.equal('-1');
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue