-
Notifications
You must be signed in to change notification settings - Fork 4k
feat(keyboard-shortcut): enhance keyboard-shortcut button UI and background #575
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?
feat(keyboard-shortcut): enhance keyboard-shortcut button UI and background #575
Conversation
👷 Deploy request for appcut pending review.Visit the deploys page to approve it
|
@harshdev03 is attempting to deploy a commit to the OpenCut OSS Team on Vercel. A member of the Team first needs to authorize it. |
WalkthroughThis PR adjusts styling and whitespace: minor CSS whitespace tweaks, dark/light mode classes and spacing updates in the keyboard shortcuts help component, and a hover style change for the text button variant. No behavioral or API changes. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related PRs
Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
<Dialog open={open} onOpenChange={setOpen}> | ||
<DialogTrigger asChild> | ||
<Button variant="text" size="sm" className="gap-2"> | ||
<Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border-1 border-gray-300 text-black "> |
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.
<Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border-1 border-gray-300 text-black "> | |
<Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border border-gray-300 text-black "> |
The border-1
class is invalid in Tailwind CSS. Use border
instead for a 1px border.
View Details
Analysis
The newly added styling includes border-1
which is not a valid Tailwind CSS class. Standard Tailwind CSS uses border
for a 1px border, border-2
for 2px, border-4
for 4px, etc. The border-1
class doesn't exist and will not apply any styling.
Looking at the existing codebase, all border usage follows the standard Tailwind pattern with border
for 1px borders (e.g., border border-destructive/20
, border border-foreground/15
) and border-2
for 2px borders where needed.
The fix is simple: change border-1 border-gray-300
to border border-gray-300
.
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/web/src/components/ui/button.tsx (1)
51-55
: Add a safe default type="button" to prevent unintended form submissions.Our guidelines require a type on buttons; HTML defaults to submit which can break forms.
- ({ className, variant, size, asChild = false, ...props }, ref) => { + ({ className, variant, size, asChild = false, type, ...props }, ref) => { const Comp = asChild ? SlotPrimitive.Slot : "button"; return ( <Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} + type={asChild ? undefined : (type ?? "button")} {...props} /> ); } )
🧹 Nitpick comments (3)
apps/web/src/components/ui/button.tsx (1)
24-24
: Text variant hover change is good; trim conflicting/unused classes.
transition-opacity
no longer matches the hover behavior, andp-0
/rounded-none
can fight size variants. Consider simplifying the text variant to avoid surprises.- text: "bg-transparent p-0 rounded-none opacity-100 hover:bg-foreground/15 transition-opacity", // Instead of ghost (matches app better) + text: "bg-transparent hover:bg-foreground/15", // Keep hover surface; let size control spacing/radiusapps/web/src/components/keyboard-shortcuts-help.tsx (2)
189-211
: Minor: ensure chip group doesn’t wrap awkwardly on narrow screens.If you observe wrapping between key parts and the “or” separator, consider
flex-wrap
with gap adjustments at small widths.
234-236
: Remove ineffective hover:bg-opacity-80 and redundant border override.
hover:bg-opacity-80
doesn’t affectbg-foreground/15
(slash opacity sets alpha explicitly). The else-branchborder
is redundant withvariant="outline"
.- className={`font-sans px-2 min-w-6 min-h-6 leading-none mr-1 hover:bg-opacity-80 ${ - isRecording ? "border-primary bg-primary/10" : "border bg-foreground/15" + className={`font-sans px-2 min-w-6 min-h-6 leading-none mr-1 ${ + isRecording ? "border-primary bg-primary/10" : "bg-foreground/15" }`}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (3)
apps/web/src/app/globals.css
(2 hunks)apps/web/src/components/keyboard-shortcuts-help.tsx
(3 hunks)apps/web/src/components/ui/button.tsx
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{jsx,tsx}
: Don't useaccessKey
attribute on any HTML element.
Don't setaria-hidden="true"
on focusable elements.
Don't add ARIA roles, states, and properties to elements that don't support them.
Don't use distracting elements like<marquee>
or<blink>
.
Only use thescope
prop on<th>
elements.
Don't assign non-interactive ARIA roles to interactive HTML elements.
Make sure label elements have text content and are associated with an input.
Don't assign interactive ARIA roles to non-interactive HTML elements.
Don't assigntabIndex
to non-interactive HTML elements.
Don't use positive integers fortabIndex
property.
Don't include "image", "picture", or "photo" in img alt prop.
Don't use explicit role property that's the same as the implicit/default role.
Make static elements with click handlers use a valid role attribute.
Always include atitle
element for SVG elements.
Give all elements requiring alt text meaningful information for screen readers.
Make sure anchors have content that's accessible to screen readers.
AssigntabIndex
to non-interactive HTML elements witharia-activedescendant
.
Include all required ARIA attributes for elements with ARIA roles.
Make sure ARIA properties are valid for the element's supported roles.
Always include atype
attribute for button elements.
Make elements with interactive roles and handlers focusable.
Give heading elements content that's accessible to screen readers (not hidden witharia-hidden
).
Always include alang
attribute on the html element.
Always include atitle
attribute for iframe elements.
AccompanyonClick
with at least one of:onKeyUp
,onKeyDown
, oronKeyPress
.
AccompanyonMouseOver
/onMouseOut
withonFocus
/onBlur
.
Include caption tracks for audio and video elements.
Use semantic elements instead of role attributes in JSX.
Make sure all anchors are valid and navigable.
Ensure all ARIA properties (aria-*
) are valid.
Use valid, non-abstract ARIA roles for elements with...
Files:
apps/web/src/components/keyboard-shortcuts-help.tsx
apps/web/src/components/ui/button.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{ts,tsx}
: Don't use TypeScript enums.
Don't export imported variables.
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions.
Don't use TypeScript namespaces.
Don't use non-null assertions with the!
postfix operator.
Don't use parameter properties in class constructors.
Don't use user-defined types.
Useas const
instead of literal types and type annotations.
Use eitherT[]
orArray<T>
consistently.
Initialize each enum member value explicitly.
Useexport type
for types.
Useimport type
for types.
Make sure all enum members are literal values.
Don't use TypeScript const enum.
Don't declare empty interfaces.
Don't let variables evolve into any type through reassignments.
Don't use the any type.
Don't misuse the non-null assertion operator (!) in TypeScript files.
Don't use implicit any type on variable declarations.
Don't merge interfaces and classes unsafely.
Don't use overload signatures that aren't next to each other.
Use the namespace keyword instead of the module keyword to declare TypeScript namespaces.
Don't use empty type parameters in type aliases and interfaces.
Don't use any or unknown as type constraints.
Don't use the TypeScript directive @ts-ignore.
Use consistent accessibility modifiers on class properties and methods.
Use function types instead of object types with call signatures.
Don't use void type outside of generic or return types.
**/*.{ts,tsx}
: Don't use primitive type aliases or misleading types
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Use either T[] or Array consistently
Don't use the any type
Files:
apps/web/src/components/keyboard-shortcuts-help.tsx
apps/web/src/components/ui/button.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/copilot-instructions.md)
**/*.{js,jsx,ts,tsx}
: Don't use the return value of React.render.
Don't use consecutive spaces in regular expression literals.
Don't use thearguments
object.
Don't use primitive type aliases or misleading types.
Don't use the comma operator.
Don't write functions that exceed a given Cognitive Complexity score.
Don't use unnecessary boolean casts.
Don't use unnecessary callbacks with flatMap.
Use for...of statements instead of Array.forEach.
Don't create classes that only have static members (like a static namespace).
Don't use this and super in static contexts.
Don't use unnecessary catch clauses.
Don't use unnecessary constructors.
Don't use unnecessary continue statements.
Don't export empty modules that don't change anything.
Don't use unnecessary escape sequences in regular expression literals.
Don't use unnecessary labels.
Don't use unnecessary nested block statements.
Don't rename imports, exports, and destructured assignments to the same name.
Don't use unnecessary string or template literal concatenation.
Don't use String.raw in template literals when there are no escape sequences.
Don't use useless case statements in switch statements.
Don't use ternary operators when simpler alternatives exist.
Don't use uselessthis
aliasing.
Don't initialize variables to undefined.
Don't use the void operators (they're not familiar).
Use arrow functions instead of function expressions.
Use Date.now() to get milliseconds since the Unix Epoch.
Use .flatMap() instead of map().flat() when possible.
Use literal property access instead of computed property access.
Don't use parseInt() or Number.parseInt() when binary, octal, or hexadecimal literals work.
Use concise optional chaining instead of chained logical expressions.
Use regular expression literals instead of the RegExp constructor when possible.
Don't use number literal object member names that aren't base 10 or use underscore separators.
Remove redundant terms from logical expressions.
Use while loops instead of...
Files:
apps/web/src/components/keyboard-shortcuts-help.tsx
apps/web/src/components/ui/button.tsx
**/*.{tsx,jsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{tsx,jsx}
: Always include a title element for icons unless there's text beside the icon
Always include a type attribute for button elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/onBlur
Don't import React itself
Don't define React components inside other components
Don't use both children and dangerouslySetInnerHTML on the same element
Don't insert comments as text nodes
Use <>...</> instead of ...
Files:
apps/web/src/components/keyboard-shortcuts-help.tsx
apps/web/src/components/ui/button.tsx
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)
**/*.{ts,tsx,js,jsx}
: Don't use the comma operator
Use for...of statements instead of Array.forEach
Don't initialize variables to undefined
Use .flatMap() instead of map().flat() when possible
Don't assign a value to itself
Avoid unused imports and variables
Don't use await inside loops
Don't hardcode sensitive data like API keys and tokens
Don't use the delete operator
Don't use global eval()
Use String.slice() instead of String.substr() and String.substring()
Don't use else blocks when the if block breaks early
Put default function parameters and optional function parameters last
Use new when throwing an error
Use String.trimStart() and String.trimEnd() over String.trimLeft() and String.trimRight()
Files:
apps/web/src/components/keyboard-shortcuts-help.tsx
apps/web/src/components/ui/button.tsx
🧬 Code graph analysis (1)
apps/web/src/components/ui/button.tsx (1)
apps/web/src/components/ui/alert-dialog.tsx (2)
props
(104-110)props
(116-126)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Vade Review
🔇 Additional comments (3)
apps/web/src/app/globals.css (2)
46-46
: Whitespace-only change.No semantic impact.
90-90
: Comment indentation tweak only.No semantic impact.
apps/web/src/components/keyboard-shortcuts-help.tsx (1)
181-187
: Spacing tweak LGTM.
py-0.5
improves density without harming readability.
<Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border-1 border-gray-300 text-black "> | ||
<Keyboard className="w-4 h-4" /> | ||
Shortcuts | ||
</Button> |
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.
💡 Verification agent
🧩 Analysis chain
Use design tokens/variants instead of hardcoded colors; replace non-standard border-1.
Prefer our system tokens and existing variants for cross-theme consistency. border-1
may be invalid without a custom Tailwind config.
- <Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border-1 border-gray-300 text-black ">
+ <Button variant="secondary" size="sm">
<Keyboard className="w-4 h-4" />
Shortcuts
</Button>
To verify border-1
support and avoid regressions, run:
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Searching for 'border-1' usages..."
rg -n -S '\bborder-1\b' -C2
echo -e "\nChecking Tailwind config(s) for custom border widths..."
fd -a 'tailwind*.{js,ts,cjs,mjs}' | while read -r f; do
echo "==> $f"
rg -n 'borderWidth|extend' "$f" -C3 || true
done
echo -e "\nScanning for matchUtilities/addUtilities defining custom border classes..."
rg -n 'matchUtilities|addUtilities' --type js --type ts --type tsx --type jsx -C2
Length of output: 1223
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Searching for 'border-1' usages..."
rg -n -S '\bborder-1\b' -C2 .
echo -e "\nLocating Tailwind config files..."
find . -type f -name "tailwind.config.*" -print
echo -e "\nChecking Tailwind config(s) for custom borderWidth extends..."
find . -type f -name "tailwind.config.*" -print | while read -r f; do
echo "==> $f"
grep -nE 'borderWidth|extend' "$f" || true
done
echo -e "\nScanning for custom border utilities with matchUtilities or addUtilities..."
rg -nE 'matchUtilities\(|addUtilities\(' --type js --type ts --type tsx --type jsx -C2 .
Length of output: 1357
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "Import statement for Button in keyboard-shortcuts-help.tsx:"
grep -n "import.*Button" apps/web/src/components/keyboard-shortcuts-help.tsx || true
echo -e "\nListing files in ui component directory:"
ls apps/web/src/components/ui || true
echo -e "\nDisplaying the beginning of the Button component implementation:"
for f in apps/web/src/components/ui/button.*; do
if [[ -f "$f" ]]; then
echo "==> $f"
sed -n '1,100p' "$f"
fi
done
Length of output: 3900
Replace hardcoded color classes and invalid border-1
with the secondary
Button variant.
Use the built-in secondary
variant (which applies theme tokens for background, border and text) and drop the custom className
—the base buttonVariants
already includes gap-2
.
apps/web/src/components/keyboard-shortcuts-help.tsx
- <Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border-1 border-gray-300 text-black ">
+ <Button variant="secondary" size="sm">
<Keyboard className="w-4 h-4" />
Shortcuts
</Button>
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
<Button variant="text" size="sm" className="gap-2 dark:bg-neutral-800 dark:border-neutral-800 dark:text-white bg-gray-200 border-1 border-gray-300 text-black "> | |
<Keyboard className="w-4 h-4" /> | |
Shortcuts | |
</Button> | |
<Button variant="secondary" size="sm"> | |
<Keyboard className="w-4 h-4" /> | |
Shortcuts | |
</Button> |
🤖 Prompt for AI Agents
In apps/web/src/components/keyboard-shortcuts-help.tsx around lines 108 to 111,
the Button uses hardcoded color classes and an invalid "border-1" class; replace
this by using the built-in "secondary" variant (which supplies background,
border and text tokens) and remove the custom className entirely since
buttonVariants already includes gap-2; update the Button to set
variant="secondary" and delete the className prop so styling comes from the
component variant.
Description
Enhanced the keyboard shortcut button UI by adding theme-aware background and border styling.
Additionally, refined the hover effect in the shared Button component for improved interactivity.
This improves visual clarity, accessibility, and consistency across light and dark themes.
Relates to: UI refinement and dark mode support.
Type of change
How Has This Been Tested?
Test Configuration:
Screenshots (if applicable)
Before:-
After:-


Checklist:
Summary by CodeRabbit