feat(Toast): allow action without dismissing toast#2673
Conversation
📝 WalkthroughWalkthroughThis PR adds a ChangesToastAction closeOnClick feature
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/content/docs/components/toast.md`:
- Around line 142-154: The keyboard-interaction docs incorrectly state that
ToastAction always closes on Space/Enter; update the keyboard table and any
related text to qualify that closing on Space/Enter is conditional on the prop
closeOnClick being true. Locate mentions of ToastAction and the keyboard table
in this doc (references: ToastAction, closeOnClick) and change the wording to
something like "closes on Space/Enter when closeOnClick === true" or equivalent
concise phrasing so the docs consistently reflect the conditional behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d67d0a50-1ec0-455c-a938-42671e607cc2
📒 Files selected for processing (4)
docs/content/docs/components/toast.mddocs/content/meta/ToastAction.mdpackages/core/src/Toast/Toast.test.tspackages/core/src/Toast/ToastAction.vue
| By default, clicking `ToastAction` dismisses the toast. Set `closeOnClick` to `false` when the action should run while keeping the toast visible. | ||
|
|
||
| ```vue | ||
| <template> | ||
| <ToastAction | ||
| alt-text="Retry sending the message" | ||
| :close-on-click="false" | ||
| @click="retry" | ||
| > | ||
| Retry | ||
| </ToastAction> | ||
| </template> | ||
| ``` |
There was a problem hiding this comment.
Update keyboard-interaction docs to reflect conditional close behavior.
Line 142 correctly introduces closeOnClick, but the keyboard table still says ToastAction always closes on Space/Enter. Please qualify that behavior as conditional (closeOnClick === true) to avoid conflicting guidance.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/content/docs/components/toast.md` around lines 142 - 154, The
keyboard-interaction docs incorrectly state that ToastAction always closes on
Space/Enter; update the keyboard table and any related text to qualify that
closing on Space/Enter is conditional on the prop closeOnClick being true.
Locate mentions of ToastAction and the keyboard table in this doc (references:
ToastAction, closeOnClick) and change the wording to something like "closes on
Space/Enter when closeOnClick === true" or equivalent concise phrasing so the
docs consistently reflect the conditional behavior.
🔗 Linked issue
Resolves #2626
❓ Type of change
📚 Description
Adds a
closeOnClickprop toToastActionso action buttons can run without always dismissing their toast. The default remainstrue, preserving the existing dismiss-on-click behavior.This also documents the new prop and adds a regression test covering
closeOnClick: falsekeeping the toast open after clicking the action.📸 Screenshots (if appropriate)
N/A
📝 Checklist
Summary by CodeRabbit
New Features
closeOnClickprop to toast actions to control whether toast dismisses when action is triggered.Changes
Documentation