[4.x][8221] Accesibility - snack duration, animations enabling/disabling#4923
[4.x][8221] Accesibility - snack duration, animations enabling/disabling#4923jvega190 wants to merge 4 commits into
Conversation
… and update label for clarity. Enhance EncryptTool and LoginView to utilize useSnackbarDuration for dynamic snackbar auto-hide duration.
|
Warning Review limit reached
Next review available in: 15 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
WalkthroughAdds per-user accessibility preferences for snackbar duration and UI animations, exposes reactive hooks for those settings, provides account-management controls, and applies the values to snackbar components and the MUI theme. ChangesAccessibility preferences
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
ui/app/src/utils/state.ts (1)
460-472: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicated subscribe-function boilerplate.
subscribeSnackbarDurationandsubscribeEnableAnimationsimplement the same custom-event + filtered-storage-event + cleanup pattern. As more per-user preferences are added, this duplication will grow.♻️ Suggested factory to eliminate duplication
+function createPreferenceSubscription(eventName: string, keySuffix: string) { + return function subscribe(onStoreChange: () => void) { + window.addEventListener(eventName, onStoreChange); + const storageListener = (e: StorageEvent) => { + if (e.key?.endsWith(keySuffix)) { + onStoreChange(); + } + }; + window.addEventListener('storage', storageListener); + return () => { + window.removeEventListener(eventName, onStoreChange); + window.removeEventListener('storage', storageListener); + }; + }; +} + +export const subscribeSnackbarDuration = createPreferenceSubscription(SNACKBAR_DURATION_CHANGED, '.snackbarDuration'); +export const subscribeEnableAnimations = createPreferenceSubscription(ENABLE_ANIMATIONS_CHANGED, '.enableAnimations');Also applies to: 491-504
🤖 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 `@ui/app/src/utils/state.ts` around lines 460 - 472, Extract the shared custom-event and filtered storage-event subscription logic from subscribeSnackbarDuration and subscribeEnableAnimations into a reusable helper or factory. Update both subscription functions to delegate to it while preserving their event names, .snackbarDuration/.enableAnimations storage-key filters, callbacks, and cleanup behavior.
🤖 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 `@ui/app/src/components/AccountManagement/AccountManagement.tsx`:
- Around line 389-399: Prevent zero-second snackbar durations in both
ui/app/src/components/AccountManagement/AccountManagement.tsx lines 389-399 and
ui/app/src/utils/state.ts lines 478-483: update the NumberField lower bound and
corresponding parsed-value validation or fallback so zero is never stored or
passed as autoHideDuration, while preserving the existing default behavior for
invalid values.
In `@ui/app/src/components/CrafterThemeProvider/CrafterThemeProvider.tsx`:
- Around line 47-52: Update the transitions override in CrafterThemeProvider so
it spreads the existing props.themeOptions.transitions configuration before
replacing create when animations are disabled. Preserve all user-defined
duration, easing, and other transition settings while only overriding the create
method.
---
Nitpick comments:
In `@ui/app/src/utils/state.ts`:
- Around line 460-472: Extract the shared custom-event and filtered
storage-event subscription logic from subscribeSnackbarDuration and
subscribeEnableAnimations into a reusable helper or factory. Update both
subscription functions to delegate to it while preserving their event names,
.snackbarDuration/.enableAnimations storage-key filters, callbacks, and cleanup
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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8428e2c3-c3cc-4c48-9686-ca1c93bfcdfd
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
ui/app/package.jsonui/app/src/components/AccountManagement/AccountManagement.tsxui/app/src/components/CrafterCMSNextBridge/CrafterCMSNextBridge.tsxui/app/src/components/CrafterThemeProvider/CrafterThemeProvider.tsxui/app/src/components/EncryptTool/EncryptTool.tsxui/app/src/components/LoginView/LoginView.tsxui/app/src/hooks/useEnableAnimations.tsui/app/src/hooks/useSnackbarDuration.tsui/app/src/utils/state.ts
|
@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n ui/app/src/hooks/useEnableAnimations.ts
echo "-----"
cat -n ui/app/src/hooks/useSnackbarDuration.ts
echo "-----"
sed -n '1,400p' ui/app/src/utils/state.ts | grep -n "SnackbarDuration\|EnableAnimations\|DEFAULT_SNACKBAR" -A5 -B2Length of output: 3493 🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n ui/app/src/utils/state.ts | sed -n '1,250p'Length of output: 12320 🏁 Script executed: #!/bin/bash
set -euo pipefail
wc -l ui/app/src/utils/state.ts
tail -100 ui/app/src/utils/state.ts | cat -nLength of output: 5059 🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n ui/app/src/components/AccountManagement/AccountManagement.tsxLength of output: 21439 🏁 Script executed: #!/bin/bash
set -euo pipefail
cat -n ui/app/src/components/CrafterThemeProvider/CrafterThemeProvider.tsxLength of output: 5905 🤖 web_search executed:
Length of output: 1616 Good, the package name and import path check out fine. Now let me finalize the review with all findings compiled.
What looks good:
Minor nit (non-blocking):
No other issues found. This looks ready for human review from my end. [resolve] |
|
@coderabbitai about the minor nit, that's expected, the field changes to the default value on empty on focus out. So if somebody clears the input, after focusing out it'll be set to the default |
|
Tip For best results, initiate chat on the files or code changes.
(´`) ✨ |
craftercms/craftercms#8221