From b1fc67227ca4ca3dce41d9c3b37eea8fcd6e7e88 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Fri, 1 Dec 2023 15:16:59 -0500 Subject: [PATCH] fix: column scrolls into view when option is ready --- .../picker-column-option/picker-column-option.tsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/src/components/picker-column-option/picker-column-option.tsx b/core/src/components/picker-column-option/picker-column-option.tsx index c82b5dcff3..8182ba6ee1 100644 --- a/core/src/components/picker-column-option/picker-column-option.tsx +++ b/core/src/components/picker-column-option/picker-column-option.tsx @@ -64,6 +64,20 @@ export class PickerColumnOption implements ComponentInterface { this.ariaLabel = inheritedAttributes['aria-label'] || null; } + /** + * The column options can load at any time + * so the selected option needs to tell the + * parent picker column when it is loaded + * so the picker column can ensure it is + * centered in the view. + */ + componentDidLoad() { + const parentPickerColumn = this.el.closest('ion-picker-column'); + if (parentPickerColumn !== null && this.value === parentPickerColumn.value) { + parentPickerColumn.scrollActiveItemIntoView(); + } + } + /** * When an option is clicked update the * parent picker column value. This