diff --git a/packages/hooks/__tests__/use-focus-controller.test.tsx b/packages/hooks/__tests__/use-focus-controller.test.tsx index 710b2d074a..4ac7a33e10 100644 --- a/packages/hooks/__tests__/use-focus-controller.test.tsx +++ b/packages/hooks/__tests__/use-focus-controller.test.tsx @@ -117,7 +117,6 @@ describe('useFocusController', () => { await nextTick() expect(wrapper.find('span').text()).toBe('false') - expect(wrapper.find('div').attributes('tabindex')).toBe('-1') expect(focusHandler).not.toHaveBeenCalled() expect(blurHandler).not.toHaveBeenCalled() diff --git a/packages/hooks/use-focus-controller/index.ts b/packages/hooks/use-focus-controller/index.ts index 86bcb80263..3aef3f2ab8 100644 --- a/packages/hooks/use-focus-controller/index.ts +++ b/packages/hooks/use-focus-controller/index.ts @@ -1,4 +1,4 @@ -import { getCurrentInstance, onMounted, ref, shallowRef, watch } from 'vue' +import { getCurrentInstance, onMounted, ref, shallowRef } from 'vue' import { useEventListener } from '@vueuse/core' import { isElement, isFunction } from '@element-plus/utils' import type { ShallowRef } from 'vue' @@ -64,12 +64,6 @@ export function useFocusController void }>( target.value?.focus() } - watch(wrapperRef, (el) => { - if (el) { - el.setAttribute('tabindex', '-1') - } - }) - useEventListener(wrapperRef, 'focus', handleFocus, true) useEventListener(wrapperRef, 'blur', handleBlur, true) useEventListener(wrapperRef, 'click', handleClick, true)