Skip to content

Commit

Permalink
fix: broken ActionButton
Browse files Browse the repository at this point in the history
  • Loading branch information
Bellisario committed Dec 3, 2024
1 parent 40d0568 commit 5723066
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/lib/ActionButton.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<script lang="ts">
import focusable from '$lib/focuser/focusable';
import { createEventDispatcher } from 'svelte';
const dispatch = createEventDispatcher();
interface Props {
title?: string;
Expand Down Expand Up @@ -30,6 +27,7 @@
primary = false,
disabled = false,
hoverTitle = null,
onclick: fireClick
}: Props = $props();
let styles = {
Expand All @@ -45,9 +43,9 @@
.join(' ');
}
function click() {
dispatch('click');
function handleClick() {
// @ts-ignore
fireClick()
// focus on body to prevent the button from staying focused
(document.activeElement as HTMLButtonElement).blur();
}
Expand All @@ -59,7 +57,7 @@
class:active
class:primary
class:btn--disabled={disabled}
onclick={click}
onclick={handleClick}
style={getStyle(styles)}
class:fitContent
use:focusable
Expand Down

0 comments on commit 5723066

Please sign in to comment.