Skip to content

refactor: improve type safety by removing as any casts in composer components#41568

Open
Rajkaran-122 wants to merge 1 commit into
RocketChat:developfrom
Rajkaran-122:fix/accessibility
Open

refactor: improve type safety by removing as any casts in composer components#41568
Rajkaran-122 wants to merge 1 commit into
RocketChat:developfrom
Rajkaran-122:fix/accessibility

Conversation

@Rajkaran-122

@Rajkaran-122 Rajkaran-122 commented Jul 25, 2026

Copy link
Copy Markdown

Summary

This PR resolves two explicit FIXME comments related to UI accessibility (a11y) in the Admin interface components.

What Changed

  • Added proper aria-busy='true' and aria-label={t('Loading')} attributes to the loading skeleton state in AppsUsageCard.tsx.
  • Assigned a custom id to FieldLabel and linked it properly using aria-labelledby within the multiselect component inside MultiSelectSettingInput.tsx to fix screen reader targeting.
  • Removed the stale FIXME: not accessible enough comments.

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

  • Verified code statically

Checklist

Summary by CodeRabbit

  • Accessibility Improvements
    • Improved screen reader labeling for multiselect settings.
    • Added accessible loading announcements to the Apps usage card.
    • Updated loading states to clearly communicate when content is still being retrieved.

@Rajkaran-122
Rajkaran-122 requested a review from a team as a code owner July 25, 2026 06:16
@dionisio-bot

dionisio-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@changeset-bot

changeset-bot Bot commented Jul 25, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5ce840e

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

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Updated 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.

Changes

Accessibility updates

Layer / File(s) Summary
Multiselect label association
apps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsx
The field label receives an explicit id, and the multiselect references it through aria-labelledby.
Apps usage loading state
apps/meteor/client/views/admin/subscription/components/cards/AppsUsageCard/AppsUsageCard.tsx
The loading card now sets aria-busy and uses the localized Loading label.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: type: chore

Suggested reviewers: tassoevan

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Title check ⚠️ Warning The title mentions composer type-safety fixes, but this PR only changes admin component accessibility wiring. Rename the PR to describe the actual admin accessibility updates, or include the composer type-safety changes if intended.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6dc66fb and 5ce840e.

📒 Files selected for processing (2)
  • apps/meteor/client/views/admin/settings/Setting/inputs/MultiSelectSettingInput.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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.tsx
  • apps/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

Comment on lines +26 to +28

return (
<FeatureUsageCard card={{ title: t('Apps') }}>
<FeatureUsageCard card={{ title: t('Apps') }} aria-busy='true' aria-label={t('Loading')}>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants