Skip to content

Commit e504cd7

Browse files
committed
fix: let dialog buttons be links, even though it's not MDC compliant
1 parent a6d12f4 commit e504cd7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/button/Button.svelte

+6-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
class:smui-button--color-secondary={color === 'secondary'}
1111
class:mdc-card__action={context === 'card:action'}
1212
class:mdc-card__action--button={context === 'card:action'}
13+
class:mdc-dialog__button={context === 'dialog:action'}
1314
class:mdc-top-app-bar__navigation-icon={context === 'top-app-bar:navigation'}
1415
class:mdc-top-app-bar__action-item={context === 'top-app-bar:action'}
1516
class:mdc-snackbar__action={context === 'snackbar'}
1617
use:Ripple={[ripple, {unbounded: false}]}
1718
{href}
19+
{...actionProp}
20+
{...defaultProp}
1821
{...exclude($$props, ['use', 'class', 'ripple', 'color', 'variant', 'dense', 'href'])}
1922
><slot></slot></a>
2023
{:else}
@@ -64,10 +67,10 @@
6467
6568
let context = getContext('SMUI:button:context');
6669
67-
$: actionProp = context === 'dialog:action' && action !== null ? {'data-mdc-dialog-action': action} : {};
68-
$: defaultProp = context === 'dialog:action' && defaultAction ? {'data-mdc-dialog-button-default': ''} : {};
70+
$: actionProp = (context === 'dialog:action' && action !== null) ? {'data-mdc-dialog-action': action} : {};
71+
$: defaultProp = (context === 'dialog:action' && defaultAction) ? {'data-mdc-dialog-button-default': ''} : {};
6972
70-
$: dialogExcludes = context === 'dialog:action' ? ['action', 'default'] : [];
73+
$: dialogExcludes = (context === 'dialog:action') ? ['action', 'default'] : [];
7174
7275
setContext('SMUI:label:context', 'button');
7376
setContext('SMUI:icon:context', 'button');

0 commit comments

Comments
 (0)