-
Notifications
You must be signed in to change notification settings - Fork 4.2k
fix(media-overlay): add cursor-pointer when clickable #583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,4 @@ | ||||||||||||||||||||||||||||||||||||||||
| import { Upload, Plus, Image } from "lucide-react"; | ||||||||||||||||||||||||||||||||||||||||
| import { Upload } from "lucide-react"; | ||||||||||||||||||||||||||||||||||||||||
| import { Button } from "@/components/ui/button"; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| interface MediaDragOverlayProps { | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -27,7 +27,10 @@ export function MediaDragOverlay({ | |||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||
| <div | ||||||||||||||||||||||||||||||||||||||||
| className="flex flex-col items-center justify-center gap-4 h-full text-center rounded-lg bg-foreground/5 hover:bg-foreground/10 transition-all duration-200 p-8" | ||||||||||||||||||||||||||||||||||||||||
| className={[ | ||||||||||||||||||||||||||||||||||||||||
| "flex flex-col items-center justify-center gap-4 h-full text-center rounded-lg bg-foreground/5 hover:bg-foreground/10 transition-all duration-200 p-8", | ||||||||||||||||||||||||||||||||||||||||
| !isProcessing && onClick ? "cursor-pointer" : "cursor-default" | ||||||||||||||||||||||||||||||||||||||||
| ].join(" ")} | ||||||||||||||||||||||||||||||||||||||||
| onClick={handleClick} | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Use a semantic button instead of a div for clickability (a11y + guidelines). Current pattern attaches onClick to a non-interactive element, which violates the project guideline “Don’t use event handlers on non-interactive elements” and misses keyboard activation by default. Replace the root with a (with type and disabled), which also removes the need for extra key handlers. - <div
+ <button
+ type="button"
+ disabled={isProcessing || !onClick}
className={[
"flex flex-col items-center justify-center gap-4 h-full text-center rounded-lg bg-foreground/5 hover:bg-foreground/10 transition-all duration-200 p-8",
!isProcessing && onClick ? "cursor-pointer" : "cursor-default"
].join(" ")}
onClick={handleClick}
- >
+ >
...
- </div>
+ </button>📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
| <div className="flex items-center justify-center"> | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Don't attach handlers when not interactive.
Attaching onClick to a non-interactive element violates our JSX guideline. Only bind the handler when clickable.
📝 Committable suggestion
🤖 Prompt for AI Agents