Skip to content

Commit 22d1b77

Browse files
authored
Merge pull request #1795 from Marghen/fix-cv-dropdown-overflow-flashing-when-expanding
feat: fix CvDropdown overflow flashing when expanding
2 parents 3025ad4 + efd8a76 commit 22d1b77

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/components/CvDropdown/CvDropdown.vue

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,9 @@
3636
`${carbonPrefix}--label`,
3737
{ [`${carbonPrefix}--label--disabled`]: disabled },
3838
]"
39-
>{{ label }}</label
4039
>
40+
{{ label }}
41+
</label>
4142

4243
<div
4344
ref="listBox"
@@ -110,7 +111,10 @@
110111
ref="dropList"
111112
:aria-hidden="!open ? 'true' : 'false'"
112113
:aria-labelledby="`${uid}-label`"
113-
:class="`${carbonPrefix}--list-box__menu`"
114+
:class="[
115+
`${carbonPrefix}--list-box__menu`,
116+
{ 'cv-dropdown__menu--transition-done': transitionDone },
117+
]"
114118
role="menu"
115119
tabindex="-1"
116120
>
@@ -268,6 +272,7 @@ provide('dropdown-caption', dataCaption);
268272
const itemsList = ref([]);
269273
provide('dropdown-items', itemsList);
270274
const open = ref(false);
275+
const transitionDone = ref(false);
271276
const data = reactive({
272277
isHelper: false,
273278
isInvalid: undefined,
@@ -301,6 +306,15 @@ watch(dataValue, () => {
301306
});
302307
watch(open, () => {
303308
focusItem.value = '';
309+
if (open.value) {
310+
// Wait for the transition to complete before allowing overflow
311+
transitionDone.value = false;
312+
setTimeout(() => {
313+
transitionDone.value = true;
314+
}, 200); // Increase delay to ensure animation completes
315+
} else {
316+
transitionDone.value = false;
317+
}
304318
});
305319
const ariaLabeledBy = computed(() => {
306320
if (props.label) {
@@ -432,3 +446,13 @@ function onClick(ev) {
432446
}
433447
}
434448
</script>
449+
450+
<style lang="scss">
451+
.bx--list-box .bx--list-box__menu {
452+
overflow-y: hidden !important;
453+
}
454+
455+
.bx--list-box--expanded .bx--list-box__menu.cv-dropdown__menu--transition-done {
456+
overflow-y: auto !important;
457+
}
458+
</style>

0 commit comments

Comments
 (0)