From afc4ed5bea0ec9dd1e9a985d7b440224c8ce8d6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?w=C5=AB=20y=C4=81ng?= Date: Fri, 27 Sep 2024 16:02:40 +0800 Subject: [PATCH] fix(cascader): fix scroll to first selected node (#3342) --- src/cascader/cascader.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cascader/cascader.tsx b/src/cascader/cascader.tsx index 90e5e1fde..5f8225568 100644 --- a/src/cascader/cascader.tsx +++ b/src/cascader/cascader.tsx @@ -70,7 +70,8 @@ export default defineComponent({ const updateScrollTop = (content: HTMLDivElement) => { const cascaderMenuList = content.querySelectorAll(`.${COMPONENT_NAME.value}__menu`); cascaderMenuList.forEach((menu: HTMLDivElement) => { - const firstSelectedNode: HTMLDivElement = menu?.querySelector(`.${classPrefix.value}-is-selected`); + const firstSelectedNode: HTMLDivElement = menu?.querySelector(`.${classPrefix.value}-is-selected`) + || menu?.querySelector(`.${classPrefix.value}-is-expanded`); if (!firstSelectedNode || !menu) return; const { paddingBottom } = getComputedStyle(firstSelectedNode);