mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-15 02:11:05 +00:00
refactor(modal): set alert dialog attributes in markup (#1333)
This commit is contained in:
parent
e230db8115
commit
e62bea38aa
1 changed files with 2 additions and 12 deletions
|
@ -139,16 +139,6 @@
|
|||
$: ariaLabel =
|
||||
modalLabel || $$props["aria-label"] || modalAriaLabel || modalHeading;
|
||||
|
||||
let alertDialogProps = {};
|
||||
$: if (alert) {
|
||||
if (passiveModal) {
|
||||
alertDialogProps.role = "alert";
|
||||
}
|
||||
if (!passiveModal) {
|
||||
alertDialogProps.role = "alertdialog";
|
||||
alertDialogProps["aria-describedby"] = modalBodyId;
|
||||
}
|
||||
}
|
||||
$: if (open) {
|
||||
addModalId(id);
|
||||
} else {
|
||||
|
@ -214,9 +204,9 @@
|
|||
>
|
||||
<div
|
||||
bind:this="{innerModal}"
|
||||
role="dialog"
|
||||
tabindex="-1"
|
||||
{...alertDialogProps}
|
||||
role="{alert ? (passiveModal ? 'alert' : 'alertdialog') : 'dialog'}"
|
||||
aria-describedby="{alert && !passiveModal ? modalBodyId : undefined}"
|
||||
aria-modal="true"
|
||||
aria-label="{ariaLabel}"
|
||||
class:bx--modal-container="{true}"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue