|
36 | 36 | `${carbonPrefix}--label`, |
37 | 37 | { [`${carbonPrefix}--label--disabled`]: disabled }, |
38 | 38 | ]" |
39 | | - >{{ label }}</label |
40 | 39 | > |
| 40 | + {{ label }} |
| 41 | + </label> |
41 | 42 |
|
42 | 43 | <div |
43 | 44 | ref="listBox" |
|
110 | 111 | ref="dropList" |
111 | 112 | :aria-hidden="!open ? 'true' : 'false'" |
112 | 113 | :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 | + ]" |
114 | 118 | role="menu" |
115 | 119 | tabindex="-1" |
116 | 120 | > |
@@ -268,6 +272,7 @@ provide('dropdown-caption', dataCaption); |
268 | 272 | const itemsList = ref([]); |
269 | 273 | provide('dropdown-items', itemsList); |
270 | 274 | const open = ref(false); |
| 275 | +const transitionDone = ref(false); |
271 | 276 | const data = reactive({ |
272 | 277 | isHelper: false, |
273 | 278 | isInvalid: undefined, |
@@ -301,6 +306,15 @@ watch(dataValue, () => { |
301 | 306 | }); |
302 | 307 | watch(open, () => { |
303 | 308 | 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 | + } |
304 | 318 | }); |
305 | 319 | const ariaLabeledBy = computed(() => { |
306 | 320 | if (props.label) { |
@@ -432,3 +446,13 @@ function onClick(ev) { |
432 | 446 | } |
433 | 447 | } |
434 | 448 | </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