Skip to content

fix(toast): hide static toast when dragging to prevent duplicates#5889

Closed
hassanzadeh-mj wants to merge 6 commits into
heroui-inc:canaryfrom
hassanzadeh-mj:fix/toast-drag-opacity-issue-5883
Closed

fix(toast): hide static toast when dragging to prevent duplicates#5889
hassanzadeh-mj wants to merge 6 commits into
heroui-inc:canaryfrom
hassanzadeh-mj:fix/toast-drag-opacity-issue-5883

Conversation

@hassanzadeh-mj
Copy link
Copy Markdown

@hassanzadeh-mj hassanzadeh-mj commented Nov 9, 2025

Closes #

📝 Description

⛳️ Current behavior (updates)

🚀 New behavior

💣 Is this a breaking change (Yes/No):

📝 Additional Information

Summary by CodeRabbit

Release Notes

  • New Features

    • Added V3 Release Banner to documentation homepage highlighting HeroUI v3.0.0 (Beta).
  • Refactor

    • Simplified toast animations by removing drag-based interactions.
    • Updated documentation site banner components and displays.
    • Removed inline version indicator from navigation bar.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Nov 9, 2025

⚠️ No Changeset found

Latest commit: d1a65d9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Nov 9, 2025

@hassanzadeh-mj is attempting to deploy a commit to the HeroUI Inc Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 9, 2025

Walkthrough

The PR removes drag functionality from the toast component's public API, simplifying animation logic to depend only on region expansion and position. Concurrently, documentation site UI is updated by replacing RandomBanner with ProBanner in the layout, introducing a new V3ReleaseBanner component in the hero section, and removing a version chip from the navbar.

Changes

Cohort / File(s) Summary
Toast drag removal
packages/components/toast/src/use-toast.ts
Eliminates drag state, swipe thresholds, drag handlers, and drag-dependent animation calculations; simplifies motion props and removes drag-related data attributes from public API surface
Documentation layout & banner updates
apps/docs/app/layout.tsx, apps/docs/components/navbar.tsx
Replaces RandomBanner with ProBanner in layout; comments out version chip near Home logo in navbar
Hero announcement refresh
apps/docs/components/marketing/hero/hero.tsx, apps/docs/components/marketing/hero/v3-release-banner.tsx
Replaces announcement Chip with new V3ReleaseBanner component; removes related press handler and posthog event capture; new component renders styled Chip with gradient text and emoji link to release information

Sequence Diagram(s)

sequenceDiagram
    participant OldFlow as Toast (Drag Enabled)
    participant NewFlow as Toast (Drag Removed)
    
    note over OldFlow: Region Expansion<br/>+ Drag Events<br/>+ Opacity/Height/ScaleX<br/>calculations
    
    note over NewFlow: Region Expansion Only<br/>Static Constraints<br/>Simplified Animation
    
    OldFlow->>OldFlow: Track drag value,<br/>compute elastic constraints
    NewFlow->>NewFlow: Use static region-based<br/>constraints
    
    OldFlow->>OldFlow: Apply drag-dependent<br/>visual effects
    NewFlow->>NewFlow: Apply position/region-only<br/>visual effects
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Extra attention areas:
    • Breaking API change in useToast return type; verify all consumer code handles removed drag-related fields (drag, dragValue, shouldCloseToast, etc.)
    • Toast animation simplification logic; ensure region expansion and position-based calculations produce expected visual behavior without drag
    • V3ReleaseBanner integration; confirm gradient text rendering and link behavior align with design intent

Possibly related PRs

Suggested labels

👀 Status: To Review

Suggested reviewers

  • jrgarciadev
  • wingkwong

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR removes drag functionality entirely rather than fixing the duplicate visibility issue during drag animations as intended by issue #5883, which creates a mismatch between the stated objective and the actual implementation. Clarify whether the complete removal of drag functionality is the intended solution or if the drag feature should be preserved with the duplicate visibility issue fixed instead.
Out of Scope Changes check ⚠️ Warning Changes to docs layout (RandomBanner→ProBanner, Chip→V3ReleaseBanner, navbar version chip removal) are unrelated to the toast drag duplicate issue defined in #5883. Move docs/marketing/banner changes to a separate PR focused on documentation updates and keep this PR narrowly scoped to the toast component fix.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Description check ❓ Inconclusive The PR description addresses the issue resolution and includes initial implementation details, but the template sections (Current behavior, New behavior, Breaking change, Additional Information) are not properly filled out. Complete the PR description template by filling in Current behavior (updates), New behavior, Breaking change status, and Additional Information sections for clarity.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The PR title describes a fix to hide static toast during dragging to prevent duplicates, which aligns with the primary objective to eliminate duplicate toast visuals, though it doesn't fully reflect that drag functionality was removed entirely.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/components/toast/src/toast.tsx (1)

88-90: Remove redundant ref prop.

The ref={domRef} on line 89 is redundant because getToastProps() already includes ref: domRef in the returned props object (see line 430 in use-toast.ts). Since both reference the same value, this doesn't cause functional issues, but the explicit ref can be removed for cleaner code.

Apply this diff to remove the redundancy:

     <Component
-      ref={domRef}
       {...toastProps}
       style={{
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0344123 and cf70153.

📒 Files selected for processing (2)
  • packages/components/toast/src/toast.tsx (2 hunks)
  • packages/components/toast/src/use-toast.ts (1 hunks)
🔇 Additional comments (3)
packages/components/toast/src/use-toast.ts (1)

718-718: LGTM! Exposing drag state enables the fix.

This change correctly exposes the existing internal drag state (defined at line 362) as part of the public API, allowing consuming components to react to drag interactions.

packages/components/toast/src/toast.tsx (2)

59-59: LGTM! Accessing drag state from the hook.

The destructured drag property is now available from the useToast hook and will be used to control the static toast visibility during drag interactions.


86-87: Effective fix for the duplicate toast issue.

Storing toastProps in a variable and conditionally overriding the opacity to 0 during drag correctly hides the static toast element, ensuring only the dragged framer-motion wrapper is visible. This resolves the duplicate toast visibility reported in issue #5883.

Also applies to: 91-94

Comment thread packages/components/toast/src/toast.tsx Outdated
@hassanzadeh-mj
Copy link
Copy Markdown
Author

@wingkwong

To remove the underlying toast, a feature needs to be added to Framer Motion, because when dragging occurs, it takes a snapshot of the toast and displays it.
I’ve removed the drag functionality so that the toast can now be dismissed officially using a button.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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)
packages/components/toast/src/use-toast.ts (1)

456-468: Remove duplicate toast.key from dependencies.

The dependency array includes toast.key twice (lines 462 and 466), which is redundant. While this doesn't cause runtime issues, it's unnecessary and should be cleaned up.

Apply this diff:

   [
     slots,
     classNames,
     toastProps,
     hoverProps,
     toast,
-    toast.key,
     opacityValue,
     isToastExiting,
     state,
     toast.key,
     disableAnimation,
   ],
🧹 Nitpick comments (1)
packages/components/toast/src/use-toast.ts (1)

659-678: Clean up unnecessary dependencies in getMotionDivProps.

The dependency array includes stable values that don't need to be tracked:

  • dataAttr (line 672) is an imported utility function with a stable reference
  • setDrag (line 673) is a state setter guaranteed to be stable by React

Removing these will prevent unnecessary callback recreation and align with React best practices.

Apply this diff:

   [
     total,
     index,
     placement,
     isRegionExpanded,
     isToastExiting,
     liftHeight,
     multiplier,
     initialHeight,
     frontHeight,
     toastVariants,
     classNames,
     drag,
-    dataAttr,
-    setDrag,
     shouldCloseToast,
     slots,
     toastOffset,
     maxVisibleToasts,
   ],
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cf70153 and e3c4865.

📒 Files selected for processing (1)
  • packages/components/toast/src/use-toast.ts (2 hunks)
🔇 Additional comments (1)
packages/components/toast/src/use-toast.ts (1)

719-719: Exposing drag state enables conditional styling in consumer.

Exposing the drag boolean allows the toast consumer (toast.tsx) to apply opacity changes selectively to the dragged toast, which aligns with the PR objective. However, this is only effective if the drag state updates correctly (see concern about dragListener: false at line 650).

Comment thread packages/components/toast/src/use-toast.ts Outdated
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Nov 11, 2025

Open in StackBlitz

@heroui/accordion

npm i https://pkg.pr.new/@heroui/accordion@5889

@heroui/alert

npm i https://pkg.pr.new/@heroui/alert@5889

@heroui/autocomplete

npm i https://pkg.pr.new/@heroui/autocomplete@5889

@heroui/avatar

npm i https://pkg.pr.new/@heroui/avatar@5889

@heroui/badge

npm i https://pkg.pr.new/@heroui/badge@5889

@heroui/breadcrumbs

npm i https://pkg.pr.new/@heroui/breadcrumbs@5889

@heroui/button

npm i https://pkg.pr.new/@heroui/button@5889

@heroui/calendar

npm i https://pkg.pr.new/@heroui/calendar@5889

@heroui/card

npm i https://pkg.pr.new/@heroui/card@5889

@heroui/checkbox

npm i https://pkg.pr.new/@heroui/checkbox@5889

@heroui/chip

npm i https://pkg.pr.new/@heroui/chip@5889

@heroui/code

npm i https://pkg.pr.new/@heroui/code@5889

@heroui/date-input

npm i https://pkg.pr.new/@heroui/date-input@5889

@heroui/date-picker

npm i https://pkg.pr.new/@heroui/date-picker@5889

@heroui/divider

npm i https://pkg.pr.new/@heroui/divider@5889

@heroui/drawer

npm i https://pkg.pr.new/@heroui/drawer@5889

@heroui/dropdown

npm i https://pkg.pr.new/@heroui/dropdown@5889

@heroui/form

npm i https://pkg.pr.new/@heroui/form@5889

@heroui/image

npm i https://pkg.pr.new/@heroui/image@5889

@heroui/input

npm i https://pkg.pr.new/@heroui/input@5889

@heroui/input-otp

npm i https://pkg.pr.new/@heroui/input-otp@5889

@heroui/kbd

npm i https://pkg.pr.new/@heroui/kbd@5889

@heroui/link

npm i https://pkg.pr.new/@heroui/link@5889

@heroui/listbox

npm i https://pkg.pr.new/@heroui/listbox@5889

@heroui/menu

npm i https://pkg.pr.new/@heroui/menu@5889

@heroui/modal

npm i https://pkg.pr.new/@heroui/modal@5889

@heroui/navbar

npm i https://pkg.pr.new/@heroui/navbar@5889

@heroui/number-input

npm i https://pkg.pr.new/@heroui/number-input@5889

@heroui/pagination

npm i https://pkg.pr.new/@heroui/pagination@5889

@heroui/popover

npm i https://pkg.pr.new/@heroui/popover@5889

@heroui/progress

npm i https://pkg.pr.new/@heroui/progress@5889

@heroui/radio

npm i https://pkg.pr.new/@heroui/radio@5889

@heroui/ripple

npm i https://pkg.pr.new/@heroui/ripple@5889

@heroui/scroll-shadow

npm i https://pkg.pr.new/@heroui/scroll-shadow@5889

@heroui/select

npm i https://pkg.pr.new/@heroui/select@5889

@heroui/skeleton

npm i https://pkg.pr.new/@heroui/skeleton@5889

@heroui/slider

npm i https://pkg.pr.new/@heroui/slider@5889

@heroui/snippet

npm i https://pkg.pr.new/@heroui/snippet@5889

@heroui/spacer

npm i https://pkg.pr.new/@heroui/spacer@5889

@heroui/spinner

npm i https://pkg.pr.new/@heroui/spinner@5889

@heroui/switch

npm i https://pkg.pr.new/@heroui/switch@5889

@heroui/table

npm i https://pkg.pr.new/@heroui/table@5889

@heroui/tabs

npm i https://pkg.pr.new/@heroui/tabs@5889

@heroui/toast

npm i https://pkg.pr.new/@heroui/toast@5889

@heroui/tooltip

npm i https://pkg.pr.new/@heroui/tooltip@5889

@heroui/user

npm i https://pkg.pr.new/@heroui/user@5889

@heroui/react

npm i https://pkg.pr.new/@heroui/react@5889

@heroui/system

npm i https://pkg.pr.new/@heroui/system@5889

@heroui/system-rsc

npm i https://pkg.pr.new/@heroui/system-rsc@5889

@heroui/theme

npm i https://pkg.pr.new/@heroui/theme@5889

@heroui/use-aria-accordion

npm i https://pkg.pr.new/@heroui/use-aria-accordion@5889

@heroui/use-aria-accordion-item

npm i https://pkg.pr.new/@heroui/use-aria-accordion-item@5889

@heroui/use-aria-button

npm i https://pkg.pr.new/@heroui/use-aria-button@5889

@heroui/use-aria-link

npm i https://pkg.pr.new/@heroui/use-aria-link@5889

@heroui/use-aria-modal-overlay

npm i https://pkg.pr.new/@heroui/use-aria-modal-overlay@5889

@heroui/use-aria-multiselect

npm i https://pkg.pr.new/@heroui/use-aria-multiselect@5889

@heroui/use-aria-overlay

npm i https://pkg.pr.new/@heroui/use-aria-overlay@5889

@heroui/use-callback-ref

npm i https://pkg.pr.new/@heroui/use-callback-ref@5889

@heroui/use-clipboard

npm i https://pkg.pr.new/@heroui/use-clipboard@5889

@heroui/use-data-scroll-overflow

npm i https://pkg.pr.new/@heroui/use-data-scroll-overflow@5889

@heroui/use-disclosure

npm i https://pkg.pr.new/@heroui/use-disclosure@5889

@heroui/use-draggable

npm i https://pkg.pr.new/@heroui/use-draggable@5889

@heroui/use-form-reset

npm i https://pkg.pr.new/@heroui/use-form-reset@5889

@heroui/use-image

npm i https://pkg.pr.new/@heroui/use-image@5889

@heroui/use-infinite-scroll

npm i https://pkg.pr.new/@heroui/use-infinite-scroll@5889

@heroui/use-intersection-observer

npm i https://pkg.pr.new/@heroui/use-intersection-observer@5889

@heroui/use-is-mobile

npm i https://pkg.pr.new/@heroui/use-is-mobile@5889

@heroui/use-is-mounted

npm i https://pkg.pr.new/@heroui/use-is-mounted@5889

@heroui/use-measure

npm i https://pkg.pr.new/@heroui/use-measure@5889

@heroui/use-pagination

npm i https://pkg.pr.new/@heroui/use-pagination@5889

@heroui/use-real-shape

npm i https://pkg.pr.new/@heroui/use-real-shape@5889

@heroui/use-ref-state

npm i https://pkg.pr.new/@heroui/use-ref-state@5889

@heroui/use-resize

npm i https://pkg.pr.new/@heroui/use-resize@5889

@heroui/use-safe-layout-effect

npm i https://pkg.pr.new/@heroui/use-safe-layout-effect@5889

@heroui/use-scroll-position

npm i https://pkg.pr.new/@heroui/use-scroll-position@5889

@heroui/use-ssr

npm i https://pkg.pr.new/@heroui/use-ssr@5889

@heroui/use-theme

npm i https://pkg.pr.new/@heroui/use-theme@5889

@heroui/use-update-effect

npm i https://pkg.pr.new/@heroui/use-update-effect@5889

@heroui/use-viewport-size

npm i https://pkg.pr.new/@heroui/use-viewport-size@5889

@heroui/aria-utils

npm i https://pkg.pr.new/@heroui/aria-utils@5889

@heroui/dom-animation

npm i https://pkg.pr.new/@heroui/dom-animation@5889

@heroui/framer-utils

npm i https://pkg.pr.new/@heroui/framer-utils@5889

@heroui/react-rsc-utils

npm i https://pkg.pr.new/@heroui/react-rsc-utils@5889

@heroui/react-utils

npm i https://pkg.pr.new/@heroui/react-utils@5889

@heroui/shared-icons

npm i https://pkg.pr.new/@heroui/shared-icons@5889

@heroui/shared-utils

npm i https://pkg.pr.new/@heroui/shared-utils@5889

@heroui/stories-utils

npm i https://pkg.pr.new/@heroui/stories-utils@5889

@heroui/test-utils

npm i https://pkg.pr.new/@heroui/test-utils@5889

commit: e3c4865

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a 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

🧹 Nitpick comments (2)
apps/docs/components/marketing/hero/v3-release-banner.tsx (2)

27-35: Remove redundant CSS properties.

The gradient text span applies the same properties twice—once via Tailwind utilities in className (e.g., bg-clip-text, text-transparent) and again via inline style. This duplication is unnecessary and can cause maintenance issues.

Apply this diff to remove the redundant inline styles:

       <span
         className="animate-text-gradient inline-flex bg-clip-text font-medium text-transparent bg-[linear-gradient(90deg,#0485f7_0%,#BA8BF6_50%,#0485f7_100%)] dark:bg-[linear-gradient(90deg,#0485f7_0%,#BA8BF6_50%,#0485f7_100%)]"
-        style={{
-          fontSize: "inherit",
-          backgroundSize: "200%",
-          backgroundClip: "text",
-          WebkitBackgroundClip: "text",
-          color: "transparent",
-        }}
+        style={{
+          fontSize: "inherit",
+          backgroundSize: "200%",
+        }}
       >

13-46: Consider adding analytics tracking.

The previous announcement Chip in hero.tsx captured PostHog events on press. The new V3ReleaseBanner doesn't track clicks, which may result in lost analytics data for this prominent link.

If analytics are needed, add an onClick handler:

+import {usePostHog} from "posthog-js/react";
+
 export function V3ReleaseBanner() {
+  const posthog = usePostHog();
+
+  const handleClick = () => {
+    posthog.capture("V3 Release Banner", {
+      action: "click",
+      category: "landing-page",
+      data: releaseInfo.href,
+    });
+  };
+
   return (
     <Chip
       as="a"
       ...
       href={releaseInfo.href}
+      onClick={handleClick}
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3c4865 and ac24362.

📒 Files selected for processing (4)
  • apps/docs/app/layout.tsx (2 hunks)
  • apps/docs/components/marketing/hero/hero.tsx (2 hunks)
  • apps/docs/components/marketing/hero/v3-release-banner.tsx (1 hunks)
  • apps/docs/components/navbar.tsx (2 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-25T17:08:46.283Z
Learnt from: adbjo
Repo: heroui-inc/heroui PR: 5846
File: packages/components/tabs/src/tabs.tsx:156-157
Timestamp: 2025-10-25T17:08:46.283Z
Learning: In packages/components/tabs/src/tabs.tsx, the renderTabs useMemo dependency array intentionally includes `variant` and `isVertical` to prevent potential side-effects, even though they might appear redundant based on static analysis.

Applied to files:

  • apps/docs/components/navbar.tsx
🧬 Code graph analysis (2)
apps/docs/app/layout.tsx (1)
apps/docs/components/pro-banner.tsx (1)
  • ProBanner (13-117)
apps/docs/components/marketing/hero/hero.tsx (1)
apps/docs/components/marketing/hero/v3-release-banner.tsx (1)
  • V3ReleaseBanner (13-46)
🔇 Additional comments (3)
apps/docs/components/navbar.tsx (1)

188-203: LGTM!

Commenting out the promotional version chip is a straightforward UI cleanup. The existing versionChip at line 187 remains functional.

apps/docs/app/layout.tsx (1)

16-16: LGTM!

Clean replacement of RandomBanner with ProBanner. The component swap maintains the same layout position and structure.

Also applies to: 86-86

apps/docs/components/marketing/hero/hero.tsx (1)

26-28: LGTM! Clean refactoring to dedicated component.

Replacing the inline announcement Chip with V3ReleaseBanner improves code organization. Note that the analytics tracking for this banner was addressed in the review of v3-release-banner.tsx.

Comment thread apps/docs/components/marketing/hero/v3-release-banner.tsx
- Completely removed drag functionality from toast component
- Removed drag-related state (drag, dragValue)
- Removed drag handlers (onDragStart, onDrag, onDragEnd)
- Removed drag props (drag, dragOverlay, dragConstraints, dragElastic)
- Removed drag-related calculations (opacityValue, shouldCloseToast)
- Removed unused constants (SWIPE_THRESHOLD_X, SWIPE_THRESHOLD_Y)

Why drag was removed:
- Drag functionality was causing opacity issues during drag operations
- The drag ghost image (SVG snapshot) created by Framer Motion was causing visual artifacts
- Users can still close toasts using the close button

If drag functionality is needed in the future, use the official Framer Motion solution:
- Use dragListener={false} to prevent automatic drag listener creation
- Use useDragControls() for manual drag control
- This prevents Framer Motion from creating the SVG/ghost layer snapshot

Fixes #5883
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
packages/components/toast/src/use-toast.ts (1)

499-523: Clarify the drag restoration guidance to prevent future issues.

The comment suggests using dragListener={false} to prevent snapshot creation, but this is incomplete guidance. As identified in previous reviews, setting dragListener={false} alone disables Framer Motion's automatic pointer handlers, which prevents onDragStart, onDrag, and onDragEnd from firing.

The example should clarify that manual event handling is also required when using dragListener={false} with dragControls.

Apply this diff to improve the documentation:

  * If drag functionality is needed in the future, the official Framer Motion solution is:
- * - Use `dragListener={false}` to prevent automatic drag listener creation
- * - Use `useDragControls()` for manual drag control if needed
- * - This prevents Framer Motion from creating the SVG/ghost layer snapshot
+ * - Use `dragListener={false}` AND `useDragControls()` together
+ * - Implement manual event handlers (onPointerDown) to call controls.start()
+ * - This prevents Framer Motion from creating the SVG/ghost layer snapshot
+ * - Note: dragListener={false} alone will break drag handlers; dragControls are required
  * 
  * Example:
  * ```tsx
  * const controls = useDragControls();
+ * 
+ * function handlePointerDown(event) {
+ *   controls.start(event);
+ * }
+ * 
  * <motion.div
  *   drag="y"
  *   dragControls={controls}
  *   dragListener={false} // Prevents snapshot creation
+ *   onPointerDown={handlePointerDown} // Manual drag initiation
  * />
  * ```
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ac24362 and e059840.

📒 Files selected for processing (1)
  • packages/components/toast/src/use-toast.ts (3 hunks)
🔇 Additional comments (2)
packages/components/toast/src/use-toast.ts (2)

536-566: LGTM! Animation logic correctly simplified.

The animation properties now cleanly depend on region expansion state and toast position indices, with all drag-related calculations successfully removed. The logic is straightforward and maintains proper stacking behavior.


598-636: Drag functionality removal verified—no issues found.

The verification confirms that drag-related code has been completely and safely removed from the toast component:

  • No drag-related references in toast.tsx
  • UseToastReturn type automatically remains clean (derived from function return)
  • Close button functionality properly preserved
  • No orphaned properties or broken references detected

@hassanzadeh-mj
Copy link
Copy Markdown
Author

@wingkwong
Framer Motion does not provide any attribute or feature to remove the underlying image during drag, so I had to remove the drag functionality in order to allow the image to be removed officially via a button.

Copy link
Copy Markdown
Member

@wingkwong wingkwong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please don't include unrelated changes in this PR. The upstream should be canary, not main.

@hassanzadeh-mj hassanzadeh-mj closed this by deleting the head repository Nov 15, 2025
hassanzadeh-mj added a commit to hassanzadeh-mj/heroui that referenced this pull request Nov 15, 2025
- Remove all drag-related state management (drag, dragValue)
- Remove drag event handlers (onDrag, onDragEnd, onDragStart)
- Remove drag constraints and elastic properties
- Remove drag-related utility functions (shouldCloseToast, getDragElasticConstraints)
- Remove drag-related constants (SWIPE_THRESHOLD_X, SWIPE_THRESHOLD_Y)
- Remove drag-related data attributes (data-drag, data-drag-value)
- Remove opacity calculations based on drag values

Users can now dismiss toasts only through the close button and timeout,
providing a better and clearer user experience.

Related to heroui-inc#5889
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - Toast bugs. Dublicating toast, animation speed etc

3 participants