mirror of
https://github.com/element-plus/element-plus.git
synced 2025-02-17 11:49:41 +08:00
fix: the disabled state should not trigger focus (#18012)
* fix: the disabled state should not trigger focus * fix: update * chore: update * chore: update test * Update packages/hooks/__tests__/use-focus-controller.test.tsx Co-authored-by: qiang <qw13131wang@gmail.com> --------- Co-authored-by: qiang <qw13131wang@gmail.com>
This commit is contained in:
parent
4fac13c469
commit
19eaae7171
@ -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()
|
||||
|
||||
|
@ -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<T extends { focus: () => 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)
|
||||
|
Loading…
Reference in New Issue
Block a user