duckduckgo / macos-browser

DuckDuckGo macOS Browser
Apache License 2.0
232 stars 7 forks source link

Maintain scroll position, selection and expanded/collapsed when returning from search on bookmarks panel #3269

Closed jotaemepereira closed 1 day ago

jotaemepereira commented 6 days ago

Task/Issue URL: https://app.asana.com/0/1204006570077678/1208262956542585/f Tech Design URL: CC:

Description: Given a user on the bookmarks panel, when the user starts a search and comes back to the tree view, then the selected, collapsed and expanded folders or bookmarks should be maintained.

https://github.com/user-attachments/assets/5ae781ab-e6c5-4e48-87e1-7eea9b267fda

Steps to test this PR:

  1. Load a bunch of bookmarks
  2. Go to the bookmarks panel, scroll to the last position and open some folders
  3. Start a search, type something, and then cancel the search
  4. The opened folders should be expanded, and the scroll position should be the same before the search.

Definition of Done:

Internal references:

Pull Request Review Checklist Software Engineering Expectations Technical Design Template Pull Request Documentation

jotaemepereira commented 1 day ago

LGTM to address the specific issue. I believe I encountered a related issue which was:

  1. Have lots of bookmark folders with child folders also
  2. Scroll to bottom, expand parent and child folder
  3. Search
  4. When cancel search, position is not maintained, we are back to the top

Maybe this is an issue specific to child folders?

Anyway, you can test further, but the work here addresses this specific issue so this PR is good. 👍🏼

Thanks @aataraxiaa ! I will take another look, I tried that flow, and the position was maintained. Maybe we are hitting an edge case somehow.

https://github.com/user-attachments/assets/5382b319-842e-4b3a-be17-d9157ab2b380