refactor: improve type safety by removing as any casts in composer components#41568
refactor: improve type safety by removing as any casts in composer components#41568Rajkaran-122 wants to merge 1 commit into
Conversation
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
|
|
WalkthroughUpdated accessibility wiring for the settings multiselect and apps usage loading card. The multiselect now references its visible field label, while the loading card exposes busy-state and localized labeling attributes. ChangesAccessibility updates
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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: 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
`@apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsx`:
- Around line 26-28: Update FeatureUsageCard to accept arbitrary accessibility
and DOM props alongside children and card, then forward them to its underlying
Card element so the loading branch’s aria-busy and aria-label attributes
type-check and reach the DOM. Use the FeatureUsageCard props definition and its
rendered Card as the change points.
🪄 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 Plus
Run ID: d5fe1eef-8dcd-47f0-9070-d97eea57fd57
📒 Files selected for processing (2)
apps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsxapps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
- GitHub Check: cubic · AI code reviewer
🧰 Additional context used
📓 Path-based instructions (1)
**/*.{ts,tsx,js}
📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
**/*.{ts,tsx,js}: Write concise, technical TypeScript/JavaScript with accurate typing in Playwright tests
Avoid code comments in the implementation
Files:
apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsxapps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsx
🧠 Learnings (2)
📚 Learning: 2026-03-27T14:52:56.865Z
Learnt from: dougfabris
Repo: RocketChat/Rocket.Chat PR: 39892
File: apps/meteor/client/views/room/contextualBar/Threads/Thread.tsx:150-155
Timestamp: 2026-03-27T14:52:56.865Z
Learning: In Rocket.Chat, there are two different `ModalBackdrop` components with different prop APIs. During review, confirm the import source: (1) `rocket.chat/fuselage` `ModalBackdrop` uses `ModalBackdropProps` based on `BoxProps` (so it supports `onClick` and other Box/DOM props) and does not have an `onDismiss` prop; (2) `rocket.chat/ui-client` `ModalBackdrop` uses a narrower props interface like `{ children?: ReactNode; onDismiss?: () => void }` and handles Escape keypress and outside mouse-up, and it does not forward arbitrary DOM props such as `onClick`. Flag mismatched props (e.g., `onDismiss` passed to the fuselage component or `onClick` passed to the ui-client component) and ensure the usage matches the correct component being imported.
Applied to files:
apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsxapps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsx
📚 Learning: 2026-05-06T12:21:44.083Z
Learnt from: juliajforesti
Repo: RocketChat/Rocket.Chat PR: 40256
File: apps/meteor/client/components/CreateDiscussion/CreateDiscussion.tsx:121-149
Timestamp: 2026-05-06T12:21:44.083Z
Learning: Field wrappers in rocket.chat/fuselage-forms (Field, FieldLabel, FieldRow, FieldError, FieldHint) auto-create htmlFor/id associations, aria-describedby, and role="alert" for errors. Do not manually set htmlFor, id, aria-describedby, or role attributes when using these wrappers. This automatic wiring does not apply to plain rocket.chat/fuselage components, which require explicit ID wiring per the accessibility docs. In code reviews, prefer using fuselage-forms wrappers for form fields and verify there is no unnecessary manual ID/aria wiring in files that use these wrappers. If a component uses plain fuselage components, ensure proper id wiring as per docs.
Applied to files:
apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsxapps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsx
🔇 Additional comments (1)
apps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsx (1)
38-38: LGTM!Also applies to: 54-54
|
|
||
| return ( | ||
| <FeatureUsageCard card={{ title: t('Apps') }}> | ||
| <FeatureUsageCard card={{ title: t('Apps') }} aria-busy='true' aria-label={t('Loading')}> |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Pass the accessibility props through FeatureUsageCard.
FeatureUsageCard only accepts children and card, so this JSX causes a TypeScript excess-property error. Its implementation also does not forward arbitrary props to the underlying Card, meaning these attributes would not reach the DOM even if typing were relaxed. Extend FeatureUsageCard to accept and forward these props, or attach them to a rendered DOM/Fuselage element in this loading branch.
🤖 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
`@apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsx`
around lines 26 - 28, Update FeatureUsageCard to accept arbitrary accessibility
and DOM props alongside children and card, then forward them to its underlying
Card element so the loading branch’s aria-busy and aria-label attributes
type-check and reach the DOM. Use the FeatureUsageCard props definition and its
rendered Card as the change points.
Summary
This PR resolves two explicit
FIXMEcomments related to UI accessibility (a11y) in the Admin interface components.What Changed
aria-busy='true'andaria-label={t('Loading')}attributes to the loading skeleton state inAppsUsageCard.tsx.idtoFieldLabeland linked it properly usingaria-labelledbywithin the multiselect component insideMultiSelectSettingInput.tsxto fix screen reader targeting.FIXME: not accessible enoughcomments.Why
These changes ensure Rocket.Chat admin settings and marketplace dashboards remain compliant with web accessibility guidelines and are fully usable via screen readers.
Testing
Checklist
Summary by CodeRabbit