Skip to content

fix(react): handle missing fields and add a11y label in QuoteMessage - #1460

Open
kafeelraza wants to merge 1 commit into
RocketChat:developfrom
kafeelraza:fix/quotemessage-crash-and-a11y
Open

kafeelraza wants to merge 1 commit into
RocketChat:developfrom
kafeelraza:fix/quotemessage-crash-and-a11y

Conversation

@kafeelraza

Copy link
Copy Markdown

Description

Fixes potential runtime exceptions in QuoteMessage caused by unchecked property access and adds an accessible label to the dismiss action button.

Proposed Changes

  • Added null check for message to prevent component crashes on empty quote state.
  • Safely accessed message?.u?.username and guarded avatar URL generation.
  • Validated message.ts before passing to date-fns format to avoid RangeError: Invalid time value.
  • Safely checked file?.type before calling startsWith.
  • Added optional chaining for message.attachments?.[0] and newline regex match.
  • Added aria-label="Remove quote" to the dismiss ActionButton.
  • Added changeset for @embeddedchat/react.

Testing Done

  • Tested component in Storybook.
  • Verified rollup bundling via yarn build in packages/react.
  • Verified formatting via Prettier and ESLint.

This branch has not been deployed

No deployments
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.

1 participant