Tooltip: fix custom tabindex not work (#15619)

pull/15638/head
Simona 2019-05-21 11:46:49 +08:00 committed by hetech
parent 8933a057f2
commit c27788f993
2 changed files with 9 additions and 1 deletions

View File

@ -110,7 +110,7 @@ export default {
this.referenceElm = this.$el;
if (this.$el.nodeType === 1) {
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, 'mouseleave', this.hide);
on(this.referenceElm, 'focus', () => {

View File

@ -153,4 +153,12 @@ describe('Tooltip', () => {
}, 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');
});
});