Skip to content

Commit

Permalink
fix(cascader): fix scroll to first selected node (#3342)
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn authored Sep 27, 2024
1 parent fb7522f commit afc4ed5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cascader/cascader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit afc4ed5

Please sign in to comment.