mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 10:21:05 +00:00
fix(dropdown): prevent icon from being clickable in disabled state (#1017)
* fix(Dropdown): list icon was clickable in disabled state * fix(Dropdown): the ListBox element was selectable in disabled state if extended Dropdown
This commit is contained in:
parent
cde8a79fa8
commit
cfa036d7a6
1 changed files with 10 additions and 1 deletions
|
@ -177,6 +177,7 @@
|
|||
{disabled && 'bx--dropdown--disabled'}
|
||||
{light && 'bx--dropdown--light'}"
|
||||
on:click="{({ target }) => {
|
||||
if (disabled) return;
|
||||
open = ref.contains(target) ? !open : false;
|
||||
}}"
|
||||
disabled="{disabled}"
|
||||
|
@ -230,7 +231,15 @@
|
|||
<span class="bx--list-box__label">
|
||||
{#if selectedItem}{itemToString(selectedItem)}{:else}{label}{/if}
|
||||
</span>
|
||||
<ListBoxMenuIcon open="{open}" translateWithId="{translateWithId}" />
|
||||
<ListBoxMenuIcon
|
||||
on:click="{(e) => {
|
||||
e.stopPropagation();
|
||||
if (disabled) return;
|
||||
open = !open;
|
||||
}}"
|
||||
translateWithId="{translateWithId}"
|
||||
open="{open}"
|
||||
/>
|
||||
</button>
|
||||
{#if open}
|
||||
<ListBoxMenu aria-labelledby="{id}" id="{id}">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue