fix(popper): fix popper tabindex error (#472)

- Move tabindex attr from trigger to popper
This commit is contained in:
jeremywu 2020-10-27 14:36:41 +08:00 committed by GitHub
parent fc23a4ec04
commit 4454c75d63
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -164,7 +164,7 @@ describe('Popper.vue', () => {
const wrapper = _mount({
appendToBody: false,
})
expect(wrapper.find(`.${TEST_TRIGGER}`).attributes('tabindex')).toBe('0')
expect(wrapper.find(`.el-popper`).attributes('tabindex')).toBe('0')
})
test('should initialize a new popper when component mounted', async () => {

View File

@ -82,6 +82,7 @@ export default defineComponent({
onMouseLeave: onPopperMouseLeave,
onAfterEnter,
onAfterLeave,
tabindex: tabIndex,
visibility,
},
[
@ -99,7 +100,6 @@ export default defineComponent({
ariaDescribedby: popperId,
class: kls,
ref: 'triggerRef',
tabindex: tabIndex,
...this.events,
}

View File

@ -13,6 +13,7 @@ interface IRenderPopperProps {
popperId: string
popperRef?: Ref<HTMLElement>
pure: boolean
tabindex: number
visibility: boolean
onMouseEnter: () => void
onMouseLeave: () => void
@ -32,6 +33,7 @@ export default function renderPopper(
popperRef,
pure,
popperId,
tabindex,
visibility,
onMouseEnter,
onMouseLeave,
@ -71,6 +73,7 @@ export default function renderPopper(
id: popperId,
ref: popperRef ?? 'popperRef',
role: 'tooltip',
tabindex,
onMouseEnter,
onMouseLeave,
onClick: stop,
@ -87,6 +90,7 @@ export default function renderPopper(
'onMouseup',
'onClick',
'id',
'tabindex',
],
),
[[vShow, visibility]],