Skip to content

Clue 428 comment scrolling redux#2780

Open
lbondaryk wants to merge 7 commits intomasterfrom
CLUE-428-comment-scrolling-redux
Open

Clue 428 comment scrolling redux#2780
lbondaryk wants to merge 7 commits intomasterfrom
CLUE-428-comment-scrolling-redux

Conversation

@lbondaryk
Copy link
Contributor

Moving logic for synchronizing selection of tiles and comments into the document rather than as a by product of the comment panel.

lbondaryk and others added 2 commits February 26, 2026 11:53
…ead expansion (CLUE-428)

- Add MobX reaction in NavTabPanel so scroll-to-tile works with chat panel closed
- Remove scroll useEffect from ChatThread (was causing hidden coupling)
- Fix auto-expand to not open document thread on cross-document tile selection
- Add tests for override title fallback paths

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cused (CLUE-428)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member

@scytacki scytacki left a comment

Choose a reason for hiding this comment

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

This is better because it isn't dependent on the comment panel but it still has issues. Here is a summary generated by Claude for me.

The visible problem: The scroll sometimes works and sometimes doesn't. After investigating, there are several underlying issues:

Wrong location for the logic. The scroll-to-tile reaction was placed in NavTabPanel — a component responsible for rendering navigation tabs. It was put there because it's "always mounted," but it has no logical relationship to tile selection or scrolling. This makes the code hard to find, understand, and maintain. If NavTabPanel is ever refactored, the scroll behavior silently breaks.

Incorrect document matching. The current code uses focusDocument (the document open in the resource panel) as the scroll target for every tile selection, even when the selected tile isn't in that document. That can happen if there are different documents open on the right and left of CLUE. And the user is clicking on the right side document. In this case the code sends bogus scroll requests because the focusDocument doesn't contain the selected tile.

Overly complex indirection. The current flow is: tile gets selected → NavTabPanel reaction fires → writes to global scrollTo property on UI store → DocumentContent reaction fires → searches its rows for the tile → scrolls. This is a long chain with multiple points of failure, all to connect a tile selection to a DOM scroll.

Suggested fix: Move the scroll behavior into TileComponent — the component that wraps every tile and already watches for selection changes to render the highlight border. When a tile becomes selected, it can simply call scrollIntoView on its own DOM element. This is better because:

It's self-contained. No store indirection, no cross-component coordination, no guessing which document the tile belongs to.
It's reliable. The component knows exactly when it becomes selected and has direct access to its own DOM element.
It's in the right place. Selection highlighting and scroll-on-selection are closely related concerns — both are visual responses to a tile becoming selected.
It naturally scopes to the right document. Each TileComponent only scrolls itself within its own container, eliminating the focusDocument mismatch bug entirely.


Claude also added the following. I know you don't agree, but I'm just including it to show that I'm not the only that thinks scrolling the editable document can be a problem:
The scrolling should probably be limited to read-only/preview documents so it doesn't disruptively auto-scroll the workspace while a user is clicking around. The existing scrollTo mechanism on the UI store can remain for other use cases (e.g., clicking a comment thread header to jump to a tile).

@cypress
Copy link

cypress bot commented Mar 3, 2026

collaborative-learning    Run #17983

Run Properties:  status check passed Passed #17983  •  git commit b05978a3e9: fix: resolve no-shadow lint error in text-tile.tsx
Project collaborative-learning
Branch Review CLUE-428-comment-scrolling-redux
Run status status check passed Passed #17983
Run duration 03m 15s
Commit git commit b05978a3e9: fix: resolve no-shadow lint error in text-tile.tsx
Committer lbondaryk
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.82%. Comparing base (6855830) to head (ece5de1).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2780      +/-   ##
==========================================
- Coverage   66.83%   66.82%   -0.02%     
==========================================
  Files         843      843              
  Lines       46357    46367      +10     
  Branches    12052    12054       +2     
==========================================
- Hits        30985    30983       -2     
- Misses      14271    14283      +12     
  Partials     1101     1101              
Flag Coverage Δ
cypress-smoke 43.08% <80.00%> (-0.02%) ⬇️
jest 50.52% <25.00%> (-0.02%) ⬇️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 78.57143% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 66.81%. Comparing base (ea92ae1) to head (b05978a).

Files with missing lines Patch % Lines
src/components/tiles/text/text-tile.tsx 0.00% 2 Missing ⚠️
src/components/chat/chat-thread.tsx 83.33% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (ea92ae1) and HEAD (b05978a). Click for more details.

HEAD has 19 uploads less than BASE
Flag BASE (ea92ae1) HEAD (b05978a)
cypress-regression 13 0
cypress 6 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2780       +/-   ##
===========================================
- Coverage   86.16%   66.81%   -19.36%     
===========================================
  Files         849      844        -5     
  Lines       46449    46430       -19     
  Branches    12072    12071        -1     
===========================================
- Hits        40024    31020     -9004     
- Misses       6018    14306     +8288     
- Partials      407     1104      +697     
Flag Coverage Δ
cypress ?
cypress-regression ?
cypress-smoke 43.09% <42.85%> (-0.25%) ⬇️
jest 50.49% <71.42%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

…ns below comment text (CLUE-428)

- Move scroll-to-tile from NavTabPanel reaction into TileComponent.componentDidUpdate
  so each tile scrolls itself into view when selected (no store indirection needed)
- Remove NavTabPanel scroll reaction (setScrollTo mechanism remains for chat thread
  and toolbar callers)
- Move renderRatingButtons below comment text in CommentItem

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
lbondaryk and others added 3 commits March 3, 2026 17:07
- Allow comment text clicks to propagate to card handler for tile selection
- Delay thread scroll to wait for expanded content to render
- Allow inner tiles in read-only documents to be selected individually
- Make question prompt text select the question tile in read-only mode

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Inline hasSelectionModifier(e) to avoid shadowing the outer `append` variable.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

2 participants