Skip to content

Conversation

chadcrum
Copy link

@chadcrum chadcrum commented Sep 24, 2025

Resolves

Summary

When selecting a note from the "Go to Anything" search results, Joplin was not automatically scrolling the note list to show the selected note. This made it difficult for users to see which note was selected, especially in large note collections.

This fix adds a smart auto-scroll feature in that automatically scrolls to newly selected notes only when they are not currently visible in the viewport.

Implementation

The solution uses a pending auto-scroll pattern with three ref-based state trackers:

  • ****: Tracks the previously selected note ID
  • ****: Tracks the previously selected folder ID
  • ****: Tracks which note needs auto-scrolling

Auto-scroll triggers when:

  1. New note selection (different note selected)
  2. Folder change (switching folders via "Go to Anything")

Auto-scroll behavior:

  • Only scrolls if the target note is outside the visible range ()
  • Only triggers for single note selections (preserves multi-selection behavior)
  • One-time action: Each selection change triggers auto-scroll at most once
  • No manual scroll interference: Manual scrolling doesn't set pending flags

Key Features

Smart scrolling: Only auto-scrolls when the selected note is not visible
Cross-folder support: Handles "Go to Anything" navigation between folders
Manual scroll preservation: No interference with user scrolling
Multi-selection support: Preserves existing multi-selection behavior
Performance optimized: Uses existing function and visibility calculations

Testing

  1. Go to Anything within folder:

    • Use Ctrl+G to search for a note in the current folder that's not visible
    • Verify the note list scrolls to show the selected note
  2. Go to Anything across folders:

    • Use Ctrl+G to search for a note in a different folder
    • Verify both folder switch and note scroll work correctly
  3. Manual scrolling:

    • Scroll the note list manually
    • Verify no unexpected auto-scrolling occurs
  4. Arrow key navigation:

    • Use arrow keys to navigate visible notes
    • Verify no unnecessary scrolling for visible notes
  5. Multi-selection:

    • Select multiple notes using Ctrl+click
    • Verify auto-scroll doesn't interfere with multi-selection

This solution provides reliable auto-scrolling for "Go to Anything" while maintaining all existing navigation behaviors.


Screencast show the problem

joplin-without-fix.webm

Screencast with the fix

joplin-with-fix.webm

Copy link
Contributor

github-actions bot commented Sep 24, 2025

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@chadcrum
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@chadcrum
Copy link
Author

recheck

github-actions bot added a commit that referenced this pull request Sep 24, 2025
@chadcrum
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

@chadcrum
Copy link
Author

recheck

@chadcrum chadcrum force-pushed the fix-goto-anything-scroll-12355 branch from 2983cab to 912c81d Compare September 24, 2025 18:09
@chadcrum chadcrum marked this pull request as draft September 24, 2025 18:25
@chadcrum chadcrum force-pushed the fix-goto-anything-scroll-12355 branch from 912c81d to 83edfdb Compare September 24, 2025 18:26
@mrjo118
Copy link
Contributor

mrjo118 commented Sep 24, 2025

Please change the title of the PR to the following so that it matches the naming convention:

Desktop: Fixes #12355: Auto-scroll to selected note from 'Go to Anything' search results

@chadcrum chadcrum force-pushed the fix-goto-anything-scroll-12355 branch from 83edfdb to c5ce06d Compare September 24, 2025 19:25
@chadcrum chadcrum marked this pull request as ready for review September 26, 2025 17:54
@chadcrum chadcrum changed the title Fix: Auto-scroll to selected note from 'Go to Anything' search results Desktop: Fixes #12355: Auto-scroll to selected note from 'Go to Anything' search results Sep 26, 2025
@chadcrum chadcrum marked this pull request as draft September 26, 2025 17:59
@chadcrum chadcrum force-pushed the fix-goto-anything-scroll-12355 branch 8 times, most recently from 8f95912 to b26c10e Compare September 26, 2025 18:41
laurent22#12355)

- Add pending auto-scroll pattern that only triggers for non-visible notes
- Track selection and folder changes with ref-based state management
- Preserve manual scrolling and multi-selection behaviors
- Handle cross-folder navigation via Go to Anything

Fixes laurent22#12355
@chadcrum chadcrum force-pushed the fix-goto-anything-scroll-12355 branch from b26c10e to 8215f10 Compare September 26, 2025 18:47
@mrjo118
Copy link
Contributor

mrjo118 commented Sep 26, 2025

FYI while probably acceptable in draft stage, it's best not to force push. Once this is ready for review it's not helpful to reviewers if you keep on replacing the history. It's unnecessary to clean up the history on the branch because if it gets merged it will be squashed anyway

@chadcrum
Copy link
Author

FYI while probably acceptable in draft stage, it's best not to force push. Once this is ready for review it's not helpful to reviewers if you keep on replacing the history. It's unnecessary to clean up the history on the branch because if it gets merged it will be squashed anyway

Right - sorry about that. I will keep this in mind in the future.

@chadcrum chadcrum marked this pull request as ready for review September 26, 2025 21:45
@chadcrum
Copy link
Author

Really really ready for review this time

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.

When selecting note from "go to anything" search results, joplin doesn't scroll note list to show selected note
2 participants