Skip to content

Rallly is an open-source scheduling and collaboration tool designed to make organizing events and meetings easier.

💄 Give buttons and links press feedback on touch devices (#3547)

Luke Vella2923f24585b4
diff --git a/packages/tailwind-config/shared-styles.css b/packages/tailwind-config/shared-styles.css
index 39045421d..bc97c8ab5 100644
--- a/packages/tailwind-config/shared-styles.css
+++ b/packages/tailwind-config/shared-styles.css
@@ -366,6 +366,11 @@
* the token lands on body, where scaling it cannot feed back into rem. */
html {
@apply h-full font-sans text-gray-700;
+ /* Preflight hides the native tap highlight, which leaves links and other
+ * tappable elements with no press feedback on touch devices (hover:
+ * never fires there). Restore a subtle one; components with their own
+ * active: styles opt out. */
+ -webkit-tap-highlight-color: var(--accent);
}
*,
::before,
diff --git a/packages/ui/src/button-variants.ts b/packages/ui/src/button-variants.ts
index ca472fe60..bb445206d 100644
--- a/packages/ui/src/button-variants.ts
+++ b/packages/ui/src/button-variants.ts
@@ -4,7 +4,7 @@ import { cn } from "./lib/utils";
export const buttonVariants = cva(
cn(
- "group inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-full font-normal tracking-tight transition-[background-color,color,transform] ease-out disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:opacity-90",
+ "group inline-flex shrink-0 items-center justify-center whitespace-nowrap rounded-full font-normal tracking-tight transition-[background-color,color,transform] ease-out [-webkit-tap-highlight-color:transparent] disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:opacity-90",
),
{
variants: {
@@ -14,12 +14,12 @@ export const buttonVariants = cva(
destructive:
"bg-destructive text-destructive-foreground ring-1 ring-button-outline ring-inset hover:bg-destructive-hover not-aria-[haspopup]:active:scale-[.98] active:bg-destructive-active motion-reduce:active:scale-100",
default:
- "bg-background/80 ring-1 ring-button-outline ring-inset backdrop-blur-lg hover:bg-accent not-aria-[haspopup]:active:scale-[.98] data-popup-open:bg-accent motion-reduce:active:scale-100 dark:bg-foreground/5",
+ "bg-background/80 ring-1 ring-button-outline ring-inset backdrop-blur-lg hover:bg-accent not-aria-[haspopup]:active:scale-[.98] active:bg-accent data-popup-open:bg-accent motion-reduce:active:scale-100 dark:bg-foreground/5",
ghost:
- "border-transparent bg-transparent text-foreground ring-1 ring-transparent ring-inset hover:bg-accent not-aria-[haspopup]:active:scale-[.98] data-popup-open:bg-accent motion-reduce:active:scale-100 [&>svg]:opacity-75",
+ "border-transparent bg-transparent text-foreground ring-1 ring-transparent ring-inset hover:bg-accent not-aria-[haspopup]:active:scale-[.98] active:bg-accent data-popup-open:bg-accent motion-reduce:active:scale-100 [&>svg]:opacity-75",
actionBar:
- "border-transparent bg-action-bar text-action-bar-foreground hover:bg-action-bar-foreground/10 not-aria-[haspopup]:active:scale-[.98] data-popup-open:bg-action-bar-foreground/20 motion-reduce:active:scale-100",
- link: "border-transparent text-primary underline-offset-4 hover:underline",
+ "border-transparent bg-action-bar text-action-bar-foreground hover:bg-action-bar-foreground/10 not-aria-[haspopup]:active:scale-[.98] active:bg-action-bar-foreground/20 data-popup-open:bg-action-bar-foreground/20 motion-reduce:active:scale-100",
+ link: "border-transparent text-primary underline-offset-4 hover:underline active:opacity-70",
},
size: {
default: