Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(dify-ui): show destructive colors on keyboard focus (#44079)

yyh985ed0292b95
diff --git a/packages/dify-ui/src/button/index.tsx b/packages/dify-ui/src/button/index.tsx
index 35354f0c543..cb92e1dd959 100644
--- a/packages/dify-ui/src/button/index.tsx
+++ b/packages/dify-ui/src/button/index.tsx
@@ -81,6 +81,7 @@ const buttonVariants = cva(
class: [
'bg-components-button-destructive-secondary-bg text-components-button-destructive-secondary-text inset-ring-components-button-destructive-secondary-border',
'hover:bg-components-button-destructive-secondary-bg-hover hover:inset-ring-components-button-destructive-secondary-border-hover',
+ 'not-data-disabled:focus-visible:bg-components-button-destructive-secondary-bg-hover',
'data-disabled:text-components-button-destructive-secondary-text-disabled',
],
},
@@ -99,6 +100,7 @@ const buttonVariants = cva(
class: [
'text-components-button-destructive-ghost-text',
'hover:bg-components-button-destructive-ghost-bg-hover',
+ 'not-data-disabled:focus-visible:bg-components-button-destructive-ghost-bg-hover',
'data-disabled:text-components-button-destructive-ghost-text-disabled',
],
},
diff --git a/packages/dify-ui/src/icon-button/index.stories.tsx b/packages/dify-ui/src/icon-button/index.stories.tsx
index 95529238e51..f9983e0dced 100644
--- a/packages/dify-ui/src/icon-button/index.stories.tsx
+++ b/packages/dify-ui/src/icon-button/index.stories.tsx
@@ -81,7 +81,8 @@ export const DestructiveIntent: Story = {
parameters: {
docs: {
description: {
- story: 'Destructive intent appears on hover while the resting action remains neutral.',
+ story:
+ 'Enabled destructive actions show the same background and glyph color on hover and keyboard focus, while the resting action remains neutral.',
},
},
},
diff --git a/packages/dify-ui/src/icon-button/index.tsx b/packages/dify-ui/src/icon-button/index.tsx
index b15d6c950cc..c7a2031ed76 100644
--- a/packages/dify-ui/src/icon-button/index.tsx
+++ b/packages/dify-ui/src/icon-button/index.tsx
@@ -66,6 +66,7 @@ const iconButtonVariants = cva(
tone: 'destructive',
class: [
'text-text-tertiary hover:bg-state-destructive-hover hover:text-text-destructive',
+ 'not-data-disabled:focus-visible:bg-state-destructive-hover not-data-disabled:focus-visible:text-text-destructive',
'data-disabled:text-text-disabled data-disabled:hover:bg-transparent data-disabled:hover:text-text-disabled',
],
},
@@ -84,6 +85,7 @@ const iconButtonVariants = cva(
class: [
'bg-components-button-destructive-secondary-bg text-components-button-destructive-secondary-text inset-ring-components-button-destructive-secondary-border',
'hover:bg-components-button-destructive-secondary-bg-hover hover:inset-ring-components-button-destructive-secondary-border-hover',
+ 'not-data-disabled:focus-visible:bg-components-button-destructive-secondary-bg-hover',
'data-disabled:text-components-button-destructive-secondary-text-disabled',
],
},
@@ -102,6 +104,7 @@ const iconButtonVariants = cva(
class: [
'text-components-button-destructive-ghost-text',
'hover:bg-components-button-destructive-ghost-bg-hover',
+ 'not-data-disabled:focus-visible:bg-components-button-destructive-ghost-bg-hover',
'data-disabled:text-components-button-destructive-ghost-text-disabled',
],
},