Skip to content

Commit c27788f

Browse files
SimonaliaChenziyoung
authored andcommitted
Tooltip: fix custom tabindex not work (ElemeFE#15619)
1 parent 8933a05 commit c27788f

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

packages/tooltip/src/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export default {
110110
this.referenceElm = this.$el;
111111
if (this.$el.nodeType === 1) {
112112
this.$el.setAttribute('aria-describedby', this.tooltipId);
113-
this.$el.setAttribute('tabindex', 0);
113+
this.$el.setAttribute('tabindex', this.tabindex);
114114
on(this.referenceElm, 'mouseenter', this.show);
115115
on(this.referenceElm, 'mouseleave', this.hide);
116116
on(this.referenceElm, 'focus', () => {

test/unit/specs/tooltip.spec.js

+8
Original file line numberDiff line numberDiff line change
@@ -153,4 +153,12 @@ describe('Tooltip', () => {
153153
}, 100);
154154
});
155155
});
156+
it('custom tabindex', () => {
157+
vm = createVue(`
158+
<el-tooltip ref="tooltip" content="提示文字" :tabindex="-1">
159+
<button>click</button>
160+
</el-tooltip>
161+
`, true);
162+
expect(vm.$el.getAttribute('tabindex')).to.be.equal('-1');
163+
});
156164
});

0 commit comments

Comments
 (0)