Skip to content

fix: custom status text wrap in drawer#6778

Merged
diegolmello merged 10 commits intoRocketChat:developfrom
Yaddalapalli-Charan-Kumar-Naidu:develop
Dec 12, 2025
Merged

fix: custom status text wrap in drawer#6778
diegolmello merged 10 commits intoRocketChat:developfrom
Yaddalapalli-Charan-Kumar-Naidu:develop

Conversation

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor

@Yaddalapalli-Charan-Kumar-Naidu Yaddalapalli-Charan-Kumar-Naidu commented Nov 8, 2025

Proposed changes

This PR fixes a UI issue where the Custom Status text in the sidebar would overflow or wrap into multiple lines, causing layout misalignment.

The fix ensures that the status message is truncated with ellipsis (...) when it exceeds a single line, maintaining a clean and consistent sidebar layout across all devices and themes.

Issue(s)

Closes #6776
https://rocketchat.atlassian.net/browse/COMM-95

How to test or reproduce

  1. Open the sidebar where the user's Custom Status appears.
  2. Set a long custom status, for example:
  3. Verify that:
  • The status text now appears on only one line.
  • Long text is truncated with ... at the end.
  • Sidebar layout remains aligned and visually consistent.

Screenshots

Before After
Screenshot 2025-12-10 at 2 21 36 PM

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • Improvement (non-breaking change which improves a current function)
  • New feature (non-breaking change which adds functionality)
  • Documentation update (if none of the other choices apply)

Checklist

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works (if applicable)
  • I have added necessary documentation (if applicable)
  • Any dependent changes have been merged and published in downstream modules

Summary by CodeRabbit

  • Bug Fixes

    • Long list item titles now reliably truncate to preserve layout.
  • New Features

    • Title rendering accepts a configurable line limit (numberOfLines) for truncation.
    • Sidebar status titles default to a single-line display for consistent layout.
  • Documentation / Demo

    • Story/demo updated to showcase long-title truncation and layout behavior.

✏️ Tip: You can customize this high-level summary in your review settings.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Nov 8, 2025

CLA assistant check
All committers have signed the CLA.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 8, 2025

Warning

Rate limit exceeded

@diegolmello has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 2 minutes and 47 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 8924c83 and f6797aa.

⛔ Files ignored due to path filters (1)
  • app/containers/List/__snapshots__/List.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • app/containers/List/List.stories.tsx (1 hunks)
  • app/containers/List/ListItem.tsx (4 hunks)
  • app/views/SidebarView/components/CustomStatus.tsx (1 hunks)

Walkthrough

Adds an optional numberOfLines prop to list title interfaces and components, forwards it through IListItemContentListTitle, and applies numberOfLines={1} to a sidebar custom status item; a story was updated to demonstrate truncation.

Changes

Cohort / File(s) Summary
List title prop & forwarding
app/containers/List/ListItem.tsx
Adds optional numberOfLines?: number to IListItemContent and includes it in IListTitle. ListTitle component signature accepts numberOfLines and forwards it to the underlying Text when title is a string. Content forwards numberOfLines to ListTitle.
Sidebar usage
app/views/SidebarView/components/CustomStatus.tsx
Sets numberOfLines={1} on the List.Item title rendering to constrain custom status text to a single line.
Storybook example
app/containers/List/List.stories.tsx
Adds a List.Item with title={longText} and numberOfLines={1}, and inserts a List.Separator to demonstrate truncation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Review attention:
    • Confirm numberOfLines is optional and correctly typed.
    • Verify all consumers of IListItemContent tolerate the new optional prop.
    • Visual check in sidebar and storybook to ensure truncation behaves as intended across platforms.

Poem

🐰 I trimmed the tail of a rambly line,
One dotted hop — concise, by design.
Sidebar neat where long words spill,
A tiny cut, and all is still. ✨

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: custom status text wrap in drawer' directly describes the main bug being addressed and matches the primary changeset focus of constraining custom status text to a single line.
Linked Issues check ✅ Passed The PR implements the core requirement from #6776: constraining custom status text to a single line with ellipsis truncation, which is achieved by adding numberOfLines={1} to the CustomStatus component.
Out of Scope Changes check ✅ Passed Changes are scoped appropriately: ListItem infrastructure updates support the custom status fix, Storybook changes document the new behavior, and no unrelated modifications are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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 and usage tips.

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

@Rohit3523 @diegolmello can you review my PR and let me any further modifications needed in this

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

Hey @Rohit3523 , one of the tests failed in the CI run. Could you please help me check what might be causing it?

@Rohit3523
Copy link
Copy Markdown
Contributor

Hey @Rohit3523 , one of the tests failed in the CI run. Could you please help me check what might be causing it?

Update the storybook snap using yarn test-update and make sure you are using node 22

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

Hey @Rohit3523 , one of the tests failed in the CI run. Could you please help me check what might be causing it?

Update the storybook snap using yarn test-update and make sure you are using node 22

ok, I will check and update it

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

@Rohit3523 @diegolmello can anyone review the PR and let me know any changes required

@Rohit3523
Copy link
Copy Markdown
Contributor

I think it will also truncate other list items, can you please test this case

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/containers/List/ListItem.tsx (1)

68-68: Refine the ellipsizeMode type for better type safety.

The as any cast on line 77 indicates a type mismatch. React Native's Text component expects ellipsizeMode to be 'head' | 'middle' | 'tail' | 'clip', but it's currently typed as string in IListItemContent (line 110).

Apply this diff to improve type safety:

In IListItemContent interface (line 110):

 	numberOfLines?: number;
-	ellipsizeMode?: string;
+	ellipsizeMode?: 'head' | 'middle' | 'tail' | 'clip';

In ListTitle component (line 77):

 	<Text
 		numberOfLines={numberOfLines}
-		ellipsizeMode={ellipsizeMode as any}
+		ellipsizeMode={ellipsizeMode}
 		style={[styles.title, styleTitle, { color: color || colors.fontDefault }]}>

Also applies to: 75-78

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between e1e20a5 and 3e21691.

📒 Files selected for processing (2)
  • app/containers/List/ListItem.tsx (4 hunks)
  • app/views/SidebarView/components/CustomStatus.tsx (1 hunks)
🔇 Additional comments (3)
app/views/SidebarView/components/CustomStatus.tsx (1)

75-76: LGTM! Fix correctly addresses the issue.

The addition of numberOfLines={1} and ellipsizeMode='tail' properly constrains the custom status text to a single line with ellipsis truncation, resolving the layout issue reported in #6776.

app/containers/List/ListItem.tsx (2)

65-66: LGTM! Interface correctly extended.

The interface properly picks the new numberOfLines and ellipsizeMode props from IListItemContent.


132-134: LGTM! Props correctly threaded through the component.

The numberOfLines and ellipsizeMode props are properly destructured and forwarded to ListTitle. The optional nature of these props ensures backward compatibility with existing usage.

Also applies to: 176-185

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

@Rohit3523 made changes such that it only truncates particular status list item

@Rohit3523 Rohit3523 changed the title fix:Custom Status text wrap #6776 fix: custom status text wrap in drawer Nov 28, 2025
@Rohit3523
Copy link
Copy Markdown
Contributor

Rohit3523 commented Nov 28, 2025

Can you please update your branch with develop and add a before screenshot in the PR description
Leave a comment once done

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

Yaddalapalli-Charan-Kumar-Naidu commented Nov 29, 2025

@Rohit3523 I have updated the develop branch and also added a screenshot for before in the PR description

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

@Rohit3523 @diegolmello @OtavioStasiak can anyone review my PR

@Rohit3523
Copy link
Copy Markdown
Contributor

Rohit3523 commented Dec 10, 2025

Hey, sorry for the delay.

In app/containers/List/List.stories.tsx, can you please add one more List component in TitleAndSubtitle function and pass numberOfLines={1} and ellipsizeMode in the prop. You can also use the same code from line 22 and add numberOfLines and remove others

@Rohit3523
Copy link
Copy Markdown
Contributor

You can remove the other props and keep text and new prop you have added, also after this run yarn test-update to update the snapshot

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

ok sure

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/containers/List/List.stories.tsx (1)

24-24: Add translateTitle={false} for consistency.

The longText variable contains literal text rather than a translation key. Following the pattern established elsewhere in this file (lines 22, 34, 38), you should include translateTitle={false} when using longText as the title.

Apply this diff:

-<List.Item title={longText} numberOfLines={1} />
+<List.Item title={longText} numberOfLines={1} translateTitle={false} />
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 111d771 and 90c3dd5.

⛔ Files ignored due to path filters (1)
  • app/containers/List/__snapshots__/List.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • app/containers/List/List.stories.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/containers/List/List.stories.tsx (1)
.rnstorybook/utils.ts (1)
  • longText (1-2)

@Rohit3523
Copy link
Copy Markdown
Contributor

Rohit3523 commented Dec 10, 2025

Sorry, I just noticed it is important to have translateTitle={false} because title will translate if we don't pass this props ;-;

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

ok I will update it

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/containers/List/List.stories.tsx (1)

24-25: LGTM! Story correctly demonstrates truncation.

The added List.Item effectively demonstrates the single-line truncation behavior with numberOfLines={1}. The implementation follows the reviewer's guidance and aligns with the PR objectives.

Optional: Consider adding ellipsizeMode for completeness.

Based on the AI summary, the actual implementation in CustomStatus.tsx uses both numberOfLines={1} and ellipsizeMode='tail'. For consistency and to fully document the truncation behavior in the story, you could optionally add ellipsizeMode='tail':

-<List.Item title={longText} subtitle={longText} translateTitle={false} translateSubtitle={false} numberOfLines={1} />
+<List.Item title={longText} subtitle={longText} translateTitle={false} translateSubtitle={false} numberOfLines={1} ellipsizeMode='tail' />

This would make the story a complete demonstration of the truncation implementation used in the actual feature.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 90c3dd5 and f466cf6.

⛔ Files ignored due to path filters (1)
  • app/containers/List/__snapshots__/List.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • app/containers/List/List.stories.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
app/containers/List/List.stories.tsx (1)
.rnstorybook/utils.ts (1)
  • longText (1-2)

@Rohit3523
Copy link
Copy Markdown
Contributor

Umm, ellipsizeMode is missing ;-;

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

added the the ellipsizeMode prop

@Rohit3523
Copy link
Copy Markdown
Contributor

Looking good to merge

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

Yaddalapalli-Charan-Kumar-Naidu commented Dec 10, 2025

Thanks a lot for the review and your support

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

can you approve this PR and merge it

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
app/containers/List/ListItem.tsx (2)

68-87: Consider adding ellipsizeMode for explicit truncation behavior.

The implementation correctly forwards numberOfLines to the Text component. While React Native defaults to ellipsizeMode="tail" when numberOfLines is set, explicitly specifying it improves code clarity and matches the story usage pattern requested by the reviewer.

Apply this diff:

 const ListTitle = ({ title, color, styleTitle, translateTitle, numberOfLines }: IListTitle) => {
 	'use memo';
 
 	const { colors } = useTheme();
 	switch (typeof title) {
 		case 'string':
 			return (
 				<Text
 					numberOfLines={numberOfLines}
+					ellipsizeMode={numberOfLines ? 'tail' : undefined}
 					style={[styles.title, styleTitle, { color: color || colors.fontDefault }]}>
 					{translateTitle && title ? I18n.t(title) : title}
 				</Text>
 			);
 		case 'function':
 			return title();
 
 		default:
 			return null;
 	}
 };

Note: Function-based titles (case 'function') will not respect numberOfLines since they return custom JSX. This is likely intentional but worth documenting if it affects your use case.


130-133: Minor: Remove trailing whitespace.

There's an unnecessary empty line after the numberOfLines parameter.

Apply this diff:

 	accessibilityLabel,
 	numberOfLines,
-	
 }: IListItemContent) => {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Jira integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bead651 and 8924c83.

⛔ Files ignored due to path filters (1)
  • app/containers/List/__snapshots__/List.test.tsx.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • app/containers/List/List.stories.tsx (1 hunks)
  • app/containers/List/ListItem.tsx (4 hunks)
  • app/views/SidebarView/components/CustomStatus.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/views/SidebarView/components/CustomStatus.tsx
🧰 Additional context used
🧬 Code graph analysis (2)
app/containers/List/List.stories.tsx (1)
.rnstorybook/utils.ts (1)
  • longText (1-2)
app/containers/List/ListItem.tsx (2)
app/theme.tsx (1)
  • useTheme (29-29)
app/lib/constants/colors.ts (1)
  • colors (280-302)
🔇 Additional comments (3)
app/containers/List/ListItem.tsx (3)

65-66: LGTM! Clean interface extension.

The numberOfLines addition to IListTitle properly maintains type consistency with IListItemContent using the Pick utility type.


108-108: LGTM! Proper optional prop.

The numberOfLines prop is correctly typed as optional, allowing components to opt into truncation behavior as needed.


174-182: LGTM! Proper prop forwarding.

The numberOfLines prop is correctly forwarded from Content to ListTitle, completing the prop threading from ListItemContentListTitleText.

Note: The subtitle on line 188 has numberOfLines={1} hardcoded, meaning subtitles are always single-line regardless of the numberOfLines prop. This appears intentional and aligns with the PR objective of keeping the sidebar layout compact.

@diegolmello diegolmello merged commit bddcf52 into RocketChat:develop Dec 12, 2025
3 checks passed
@diegolmello
Copy link
Copy Markdown
Member

@Yaddalapalli-Charan-Kumar-Naidu merged, thanks for your contribution!

@Yaddalapalli-Charan-Kumar-Naidu
Copy link
Copy Markdown
Contributor Author

@diegolmello Thank you, I appreciate the review and guidance. Excited to continue contributing

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.

bug: custom status text wraps onto multiple lines in the sidebar

4 participants