fix(button): only set disabled attribute if true #755

Fixes #755
This commit is contained in:
Eric Y Liu 2021-07-18 05:37:53 -07:00
commit e049d7b347
2 changed files with 6 additions and 1 deletions

View file

@ -5,6 +5,7 @@
import TextBold16 from "carbon-icons-svelte/lib/TextBold16"; import TextBold16 from "carbon-icons-svelte/lib/TextBold16";
import TextItalic16 from "carbon-icons-svelte/lib/TextItalic16"; import TextItalic16 from "carbon-icons-svelte/lib/TextItalic16";
import TextUnderline16 from "carbon-icons-svelte/lib/TextUnderline16"; import TextUnderline16 from "carbon-icons-svelte/lib/TextUnderline16";
import Login16 from "carbon-icons-svelte/lib/Login16";
import Preview from "../../components/Preview.svelte"; import Preview from "../../components/Preview.svelte";
let index = 1; let index = 1;
@ -54,6 +55,10 @@
<Button iconDescription="Tooltip text" icon={Add16} /> <Button iconDescription="Tooltip text" icon={Add16} />
### Icon-only, link button
<Button iconDescription="Login" icon={Login16} href="#" />
### Icon-only button (custom tooltip position) ### Icon-only button (custom tooltip position)
The tooltip position and alignment can be controlled by `tooltipPosition` and `tooltipAlignment`. The tooltip position and alignment can be controlled by `tooltipPosition` and `tooltipAlignment`.

View file

@ -95,7 +95,7 @@
$: buttonProps = { $: buttonProps = {
type: href && !disabled ? undefined : type, type: href && !disabled ? undefined : type,
tabindex, tabindex,
disabled, disabled: disabled === true ? true : undefined,
href, href,
"aria-pressed": hasIconOnly && kind === "ghost" ? isSelected : undefined, "aria-pressed": hasIconOnly && kind === "ghost" ? isSelected : undefined,
...$$restProps, ...$$restProps,