Skip to content

fix: Prevent auto-scroll to thread parent message on click - #36531

Open
onozaty wants to merge 10 commits into
RocketChat:developfrom
onozaty:fix/prevent-auto-scroll-to-thread-start-message
Open

fix: Prevent auto-scroll to thread parent message on click#36531
onozaty wants to merge 10 commits into
RocketChat:developfrom
onozaty:fix/prevent-auto-scroll-to-thread-start-message

Conversation

@onozaty

@onozaty onozaty commented Jul 25, 2025

Copy link
Copy Markdown

Remove unintended navigation to parent message when clicking thread message preview. Always navigate to the clicked message instead of parent message.

Proposed changes (including videos or screenshots)

Fixed the click behavior in ThreadMessagePreview.tsx to always navigate to the clicked reply message instead of conditionally navigating to the parent message.
This restores the intuitive behavior where clicking a message takes you to that specific message.

Root Cause:
The keyboard navigation feature added in #31549 unified the click handling, causing all clicks on thread message previews with parent message display (!sequential) to navigate to the parent message instead of the actual clicked message.

Solution:

  • Simplified handleThreadClick to always use message._id (the reply message ID)
  • Removed the conditional logic that was causing navigation to parent message based on sequential flag

Changes:

  • Modified apps/meteor/client/components/message/variants/ThreadMessagePreview.tsx
  • Updated click handler to consistently navigate to the clicked message

Issue(s)

Closes #32710

Steps to test or reproduce

  1. Create a thread with multiple replies
  2. Navigate to the main room view where thread message previews are displayed
  3. Click on a thread message preview that shows the parent message (non-sequential messages)
  4. Before fix: Navigation jumps to the parent message
  5. After fix: Navigation jumps to the clicked reply message

Before fix
32710_before

After fix
32710_after

Test both scenarios:

  • Sequential messages (parent message hidden): Should navigate to reply message ✓
  • Non-sequential messages (parent message shown): Should navigate to reply message ✓

Further comments

This change restores the expected user behavior from v6.6.0 and earlier versions. The modification maintains keyboard navigation functionality while fixing the unintended click behavior. No breaking changes are introduced as this simply corrects a regression in user experience.

The fix ensures consistent behavior regardless of the sequential flag state, making the interface more predictable for users.

Remove unintended navigation to parent message when clicking thread message preview.
Always navigate to the clicked message instead of parent message.
@onozaty
onozaty requested a review from a team as a code owner July 25, 2025 13:21
@dionisio-bot

dionisio-bot Bot commented Jul 25, 2025

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

@changeset-bot

changeset-bot Bot commented Jul 25, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7577eea

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 39 packages
Name Type
@rocket.chat/meteor Patch
@rocket.chat/core-typings Patch
@rocket.chat/rest-typings Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/api-client Patch
@rocket.chat/apps Patch
@rocket.chat/core-services Patch
@rocket.chat/cron Patch
@rocket.chat/ddp-client Patch
@rocket.chat/freeswitch Patch
@rocket.chat/fuselage-ui-kit Patch
@rocket.chat/gazzodown Patch
@rocket.chat/http-router Patch
@rocket.chat/livechat Patch
@rocket.chat/model-typings Patch
@rocket.chat/ui-avatar Patch
@rocket.chat/ui-client Patch
@rocket.chat/ui-contexts Patch
@rocket.chat/web-ui-registration Patch
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/stream-hub-service Patch
@rocket.chat/license Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/pdf-worker Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/models Patch
@rocket.chat/network-broker Patch
@rocket.chat/mock-providers Patch
@rocket.chat/ui-video-conf Patch
@rocket.chat/ui-voip Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/omni-core-ee Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant

CLAassistant commented Jul 25, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@reetp

reetp commented Jul 26, 2025

Copy link
Copy Markdown
Collaborator

Please fox the outstanding issues above.

@MartinSchoeler MartinSchoeler left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hey thanks for the contribution!

I think the old behavior of the non-sequential thread preview was mistakenly changed, can you restore the first ThreadMessageRow onclick?

Let's try to restore the old behavior, that each row had it's own onclick.

You can take a look on how the component used to look like on this diff
https://github.com/RocketChat/Rocket.Chat/pull/31549/files#diff-302dadc0469566a97b3b28cfaa3f87208b9565ba5b5e192b99705423e3d95d6cR82

Comment thread .changeset/slimy-actors-report.md Outdated
@MartinSchoeler
MartinSchoeler dismissed their stale review July 28, 2025 21:15

Never mind, upon further investigation, it seems that the issue lays deeper than just adding the onclick back

@codecov

codecov Bot commented Jul 28, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.86%. Comparing base (c5f0be1) to head (7577eea).
⚠️ Report is 16 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #36531    +/-   ##
=========================================
  Coverage    65.85%   65.86%            
=========================================
  Files         3186     3190     +4     
  Lines       106663   106801   +138     
  Branches     20310    20325    +15     
=========================================
+ Hits         70241    70340    +99     
- Misses       33757    33799    +42     
+ Partials      2665     2662     -3     
Flag Coverage Δ
unit 71.14% <ø> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@onozaty

onozaty commented Jul 29, 2025

Copy link
Copy Markdown
Author

Thank you for working on this.
Is there anything I should do on my side?

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.

Prevent auto-scroll to thread start message

5 participants