Skip to content

Commit

Permalink
fix(comp:date-picker,comp:time-picker): opening picker shouldn't scro…
Browse files Browse the repository at this point in the history
…ll to window top (#1342)

* fix(comp:date-picker): opening picker shouldn't scroll to window top

* fix(comp:time-picker): opening picker shouldn't scroll to window top
  • Loading branch information
sallerli1 committed Dec 9, 2022
1 parent 52250a5 commit cce0c0e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions packages/components/date-picker/src/DatePicker.tsx
Expand Up @@ -5,7 +5,7 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import { computed, defineComponent, nextTick, normalizeClass, provide, toRef, watch } from 'vue'
import { computed, defineComponent, normalizeClass, provide, toRef, watch } from 'vue'

import { ɵOverlay } from '@idux/components/_private/overlay'
import { useDateConfig, useGlobalConfig } from '@idux/components/config'
Expand Down Expand Up @@ -77,7 +77,7 @@ export default defineComponent({
provide(datePickerToken, context)

watch(overlayOpened, opened => {
nextTick(() => {
setTimeout(() => {
if (opened) {
focus()
inputRef.value?.dispatchEvent(new FocusEvent('focus'))
Expand Down
4 changes: 2 additions & 2 deletions packages/components/date-picker/src/DateRangePicker.tsx
Expand Up @@ -5,7 +5,7 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import { computed, defineComponent, nextTick, normalizeClass, provide, toRef, watch } from 'vue'
import { computed, defineComponent, normalizeClass, provide, toRef, watch } from 'vue'

import { ɵOverlay } from '@idux/components/_private/overlay'
import { useDateConfig, useGlobalConfig } from '@idux/components/config'
Expand Down Expand Up @@ -77,7 +77,7 @@ export default defineComponent({
provide(dateRangePickerToken, context)

watch(overlayOpened, opened => {
nextTick(() => {
setTimeout(() => {
if (opened) {
focus()
inputRef.value?.dispatchEvent(new FocusEvent('focus'))
Expand Down
4 changes: 2 additions & 2 deletions packages/components/time-picker/src/TimePicker.tsx
Expand Up @@ -5,7 +5,7 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import { computed, defineComponent, nextTick, normalizeClass, provide, toRef, watch } from 'vue'
import { computed, defineComponent, normalizeClass, provide, toRef, watch } from 'vue'

import { ɵOverlay } from '@idux/components/_private/overlay'
import { useDateConfig, useGlobalConfig } from '@idux/components/config'
Expand Down Expand Up @@ -66,7 +66,7 @@ export default defineComponent({
expose({ focus, blur })

watch(overlayOpened, opened => {
nextTick(() => {
setTimeout(() => {
if (opened) {
focus()
inputRef.value?.dispatchEvent(new FocusEvent('focus'))
Expand Down
4 changes: 2 additions & 2 deletions packages/components/time-picker/src/TimeRangePicker.tsx
Expand Up @@ -5,7 +5,7 @@
* found in the LICENSE file at https://github.com/IDuxFE/idux/blob/main/LICENSE
*/

import { computed, defineComponent, nextTick, normalizeClass, provide, toRef, watch } from 'vue'
import { computed, defineComponent, normalizeClass, provide, toRef, watch } from 'vue'

import { ɵOverlay } from '@idux/components/_private/overlay'
import { useDateConfig, useGlobalConfig } from '@idux/components/config'
Expand Down Expand Up @@ -71,7 +71,7 @@ export default defineComponent({
expose({ focus, blur })

watch(overlayOpened, opened => {
nextTick(() => {
setTimeout(() => {
if (opened) {
focus()
inputRef.value?.dispatchEvent(new FocusEvent('focus'))
Expand Down

0 comments on commit cce0c0e

Please sign in to comment.