github carbon-design-system/carbon-components-svelte v0.114.7

58 minutes ago

Highlights

  • Escape inside a native modal <dialog> closes only the topmost popup. Tooltips, toggletips, list box menus, OverflowMenu, OperationalTag and actionable notifications no longer close the dialog along with themselves.
  • A Toggletip closes on an Escape pressed right after it opens.
  • A standalone Toolbar no longer calls itself a "data table toolbar".

Bug Fixes

  • tooltip: keep a native dialog open when Escape hides a tooltip by @b-r-i-a-n-w-e-s-t in #5772
  • list-box: keep a native modal dialog open when Escape closes the menu by @metonym in #5774
  • combo-box: keep a native modal dialog open when Escape clears it by @metonym in #5774
  • overflow-menu: keep a native modal dialog open when Escape closes it by @metonym in #5774
  • tag: keep a native modal dialog open when Escape closes an operational tag by @metonym in #5774
  • notification: keep a native modal dialog open when Escape closes it by @metonym in #5774
  • toggletip: close on an Escape pressed right after opening by @metonym in #5775
  • toolbar: only default ariaLabel inside a DataTable by @metonym in #5765
  • button: type class and aria-hidden on the icon slot props by @metonym in #5752

Escape in a native dialog

Components that use up Escape already stopped it from reaching a Modal. A native modal <dialog> closes as Escape's default action, though, and stopping the key doesn't cancel that. So in a Dialog with modal, one Escape closed both the popup and the dialog. These components now also prevent the default: Button, Tooltip, TooltipIcon, TooltipDefinition, CopyButton, CodeSnippet, Toggletip and the OverflowMenu trigger's tooltip, plus Dropdown, ComboBox and MultiSelect menus, a ComboBox clearing on Escape, OverflowMenu menus, OperationalTag and actionable notifications. The first Escape closes the popup, and the next one closes the dialog, as in a Modal.

<Dialog bind:open modal aria-label="Workspace">
  <Dropdown labelText="Contact" {items} />
</Dialog>

Popover, HeaderAction, ContextMenu and InlineEdit still let Escape through, in a Modal and in a native dialog alike.

Toggletip

The Escape listener turned on one animation frame after the toggletip opened. An Escape pressed before then, with focus outside the toggletip, was missed. It's now on as soon as the toggletip opens. Only the outside-click listener still waits a frame.

Toolbar

ariaLabel defaulted to "data table toolbar" everywhere. It now defaults to that only inside a DataTable. A standalone Toolbar is unlabeled unless you pass ariaLabel. The docs add a standalone icon button example.

Button

The icon slot passes class (bx--btn__icon) and aria-hidden along with style, but only style was typed, so let:class failed type checking. Both are typed now, and the custom icon example reads the class instead of hard-coding it.

<Button>
  Custom icon
  <svelte:fragment slot="icon" let:class={iconClass}>
    <Add class={iconClass} size={20} />
  </svelte:fragment>
</Button>

Full Changelog: v0.114.6...v0.114.7

Don't miss a new carbon-components-svelte release

NewReleases is sending notifications on new releases.