From 6cee99e1eaadf08ce20e13fb8e7826792deb6ee1 Mon Sep 17 00:00:00 2001 From: Davide Di Pumpo Date: Mon, 20 Oct 2025 12:03:57 +0200 Subject: [PATCH 1/5] refactor: Makes CommandButton accessible --- .../src/components/CommandButton.vue | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/vue-components/src/components/CommandButton.vue b/packages/vue-components/src/components/CommandButton.vue index d4166a1961..200291d963 100644 --- a/packages/vue-components/src/components/CommandButton.vue +++ b/packages/vue-components/src/components/CommandButton.vue @@ -4,6 +4,7 @@ generic="I = never" > import type { CommandBase } from "@effect-app/vue" +import { computed } from "vue" import type { VBtn } from "vuetify/components" export type VBtnProps = VBtn["$props"] @@ -28,6 +29,20 @@ const props = defineProps< } & ButtonProps >() + +const isDisabled = computed(() => props.command.blocked || props.disabled) + +const handleClick = () => { + // Block execution if button is disabled + if (isDisabled.value) { + return + } + + const input = ("input" in props && props.input + ? props.input + : undefined) as unknown as I + ;(props.command.handle as any)(input) +}