diff --git a/packages/vuetify/src/components/VDatePicker/VDatePickerYears.tsx b/packages/vuetify/src/components/VDatePicker/VDatePickerYears.tsx index b2c2589b887..db8bddd3059 100644 --- a/packages/vuetify/src/components/VDatePicker/VDatePickerYears.tsx +++ b/packages/vuetify/src/components/VDatePicker/VDatePickerYears.tsx @@ -95,10 +95,18 @@ export const VDatePickerYears = genericComponent()({ model.value = model.value ?? adapter.getYear(adapter.date()) }) + const containerRef = templateRef() const yearRef = templateRef() function focusSelectedYear () { - yearRef.el?.scrollIntoView({ block: 'center' }) + const container = containerRef.el + const target = yearRef.el + if (!container || !target) return + + const containerRect = container.getBoundingClientRect() + const targetRect = target.getBoundingClientRect() + + container.scrollTop += (targetRect.top - containerRect.top) - (container.clientHeight / 2) + (targetRect.height / 2) } function isYearAllowed (year: number) { @@ -116,6 +124,7 @@ export const VDatePickerYears = genericComponent()({ useRender(() => (