mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
Merge pull request #208 from IBM/fix-combobox
fix(combo-box): close menu on Escape key
This commit is contained in:
commit
b817885b32
4 changed files with 6 additions and 9 deletions
|
@ -30,7 +30,6 @@
|
|||
}
|
||||
</script>
|
||||
|
||||
<p>Currently, this component does not support items as slots.</p>
|
||||
<p>
|
||||
<code>items</code>
|
||||
must be an array of objects; mandatory fields are `id` and `text`.
|
||||
|
@ -47,8 +46,9 @@
|
|||
size="small"
|
||||
on:click={() => {
|
||||
selectedIndex = 1;
|
||||
}}>
|
||||
Set item to 'Option 2'
|
||||
}}
|
||||
style="margin-top: 1rem;">
|
||||
Set item to "Option 2"
|
||||
</Button>
|
||||
</div>
|
||||
<div style="width: 300px; margin-top: 2rem;">
|
||||
|
|
|
@ -137,6 +137,8 @@
|
|||
change(1);
|
||||
} else if (key === 'ArrowUp') {
|
||||
change(-1);
|
||||
} else if (key === 'Escape') {
|
||||
open = false;
|
||||
}
|
||||
}}
|
||||
on:focus
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
<DropdownSkeleton inline />
|
||||
</div>
|
||||
{:else}
|
||||
<p>Currently, this component does not support items as slots.</p>
|
||||
<p>
|
||||
<code>items</code>
|
||||
must be an array of objects; mandatory fields are `id` and `text`.
|
||||
|
@ -35,7 +34,7 @@
|
|||
on:click={() => {
|
||||
selectedIndex = selectedIndex > -1 ? -1 : 1;
|
||||
}}>
|
||||
{selectedIndex > -1 ? 'Clear selected item' : "Set item to 'Option 2'"}
|
||||
{selectedIndex > -1 ? 'Clear selected item' : 'Set item to "Option 2"'}
|
||||
</Button>
|
||||
</div>
|
||||
<div style="width: 300px">
|
||||
|
|
|
@ -26,10 +26,6 @@ export const Default = () => ({
|
|||
disabled: boolean("Disabled (disabled)", false),
|
||||
light: boolean("Light variant (light)", false),
|
||||
titleText: text("Title (titleText)", "This is not a dropdown title."),
|
||||
helperText: text(
|
||||
"Helper text (helperText)",
|
||||
"This is not some helper text."
|
||||
),
|
||||
invalid: boolean("Show form validation UI (invalid)", false),
|
||||
invalidText: text(
|
||||
"Form validation UI content (invalidText)",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue