summaryrefslogtreecommitdiff
path: root/apps/web/src/components/ui/visually-hidden.tsx
diff options
context:
space:
mode:
authornaoNao89 <90588855+naoNao89@users.noreply.github.com>2025-07-29 21:35:33 +0700
committernaoNao89 <90588855+naoNao89@users.noreply.github.com>2025-07-29 21:42:22 +0700
commit073cb817d342b0b54cf5ad156435a00c9bb91168 (patch)
tree84cab4ea8be934fe2f29a1c614c68e25349922ea /apps/web/src/components/ui/visually-hidden.tsx
parent14475dc9a692aeffa8ef3caccecc1d3164ce4cfc (diff)
downloadopencut-073cb817d342b0b54cf5ad156435a00c9bb91168.tar.gz
[UI] Fix dialog accessibility and export functionality
- Add DialogTitle with VisuallyHidden to CommandDialog and onboarding - Replace YouTube redirect with functional VideoExporter implementation - Create VisuallyHidden component for screen reader accessibility Resolves GitHub issue #477 (export redirecting to YouTube) Fixes console warnings about DialogContent accessibility compliance
Diffstat (limited to 'apps/web/src/components/ui/visually-hidden.tsx')
-rw-r--r--apps/web/src/components/ui/visually-hidden.tsx32
1 files changed, 32 insertions, 0 deletions
diff --git a/apps/web/src/components/ui/visually-hidden.tsx b/apps/web/src/components/ui/visually-hidden.tsx
new file mode 100644
index 00000000..7d6fc435
--- /dev/null
+++ b/apps/web/src/components/ui/visually-hidden.tsx
@@ -0,0 +1,32 @@
+"use client";
+
+import * as React from "react";
+import { cn } from "../../lib/utils";
+
+/**
+ * VisuallyHidden component provides content that is accessible to screen readers
+ * but visually hidden from sighted users. This is useful for providing context
+ * or labels that are necessary for accessibility but would be redundant visually.
+ *
+ * Based on the Radix UI VisuallyHidden primitive pattern.
+ */
+const VisuallyHidden = React.forwardRef<
+ HTMLSpanElement,
+ React.ComponentPropsWithoutRef<"span">
+>(({ className, ...props }, ref) => (
+ <span
+ ref={ref}
+ className={cn(
+ // Screen reader only styles - visually hidden but accessible
+ "absolute w-px h-px p-0 -m-px overflow-hidden whitespace-nowrap border-0",
+ // Alternative approach using sr-only if preferred
+ // "sr-only",
+ className
+ )}
+ {...props}
+ />
+));
+
+VisuallyHidden.displayName = "VisuallyHidden";
+
+export { VisuallyHidden };