From fa96095355bef2b11ce70bb6aab1b71efeb86a40 Mon Sep 17 00:00:00 2001 From: Uyarn Date: Fri, 27 Sep 2024 15:48:46 +0800 Subject: [PATCH] fix(cascader): fix scroll to first selected node --- 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);