Skip to content

Commit

Permalink
Tooltip: fix custom tabindex not work (ElemeFE#15619)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonaliaChen authored and lzq4047 committed May 22, 2020
1 parent 25e81c2 commit 1a29dab
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/tooltip/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
8 changes: 8 additions & 0 deletions test/unit/specs/tooltip.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

0 comments on commit 1a29dab

Please sign in to comment.