Skip to content

Conversation

@ShaanNarendran
Copy link
Contributor

@ShaanNarendran ShaanNarendran commented Jan 20, 2026

Purpose / Description

ANR when the scrollbar was dragged or tapped in larger collections, arose due to the addition of pr #19980

Fixes

Approach

I deleted the previous delta based logic implemented and let the new function handle dragging and tapping which doesn't cause ANRs, for extra optimisation added a scrolltopositionwithoffset.

How Has This Been Tested?

Tested the scrolling with a deck of 100k cards and found no issue on rapid scrolling for 30 seconds along with taps throughout the browser

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

@ShaanNarendran ShaanNarendran force-pushed the Scrollbar-Fix-2 branch 2 times, most recently from 1532f08 to 38247e7 Compare January 20, 2026 15:16
@david-allison
Copy link
Member

the new function

Please clarify this


In general, if you can list 'reverted X', then name the commit which is in HEAD, as this makes it easier to understand what was reverted, and what was fixed forward

I believe the commit is: ca95728

@david-allison david-allison added the Needs Author Reply Waiting for a reply from the original author label Jan 20, 2026
@ShaanNarendran
Copy link
Contributor Author

the new function

Please clarify this

Ah, by new function I meant the overriding of onTouchEvent which I had done for the main issue of tap and drag, should've phrased it better oops. Will edit the commit message now.

@ShaanNarendran
Copy link
Contributor Author

ShaanNarendran commented Jan 20, 2026

In general, if you can list 'reverted X', then name the commit which is in HEAD, as this makes it easier to understand what was reverted, and what was fixed forward

I believe the commit is: ca95728

Would I not have to mention 3c0b2bb since I removed the onTouchListener introduced in that commit, wouldn't it be better to write 'Reverts the onTouchListener introduced in 3c0b2bb'? I could be confusing the meaning of revert here so I just wanted to clarify.
Edit: 'Reverts ca95728' also seems right since introducing that pr is what caused the issue, so I suppose that's more appropriate like you said.

@ShaanNarendran
Copy link
Contributor Author

Not sure if the new commit description works, but it made sense like this in my head

@Haz3-jolt Haz3-jolt removed the Needs Author Reply Waiting for a reply from the original author label Jan 21, 2026
@ShaanNarendran
Copy link
Contributor Author

@david-allison do we want to draft since the new browser redesign is coming?

@david-allison
Copy link
Member

david-allison commented Jan 22, 2026

Let's keep going with this.

The redesign will be dev only for a long time, and I expect "production" features to break it.

In addition, I'm mostly reworking search, the rendered rows won't change

Copy link
Contributor

@criticalAY criticalAY left a comment

Choose a reason for hiding this comment

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

I tested it since you removed had the logic set by pixels and you are counting items by number, add cards with uneven content (basically not equal height for all cards) then scroll the cards you will see a sudden snap while browsing the list

@criticalAY criticalAY added Needs Author Reply Waiting for a reply from the original author and removed Needs Review labels Jan 25, 2026
@ShaanNarendran
Copy link
Contributor Author

ShaanNarendran commented Jan 25, 2026

I tested it since you removed had the logic set by pixels and you are counting items by number, add cards with uneven content (basically not equal height for all cards) then scroll the cards you will see a sudden snap while browsing the list

Could I have the deck file? I think either way, it has to be a tradeoff since if we revert to pixels then ANR is possible for decks with a large number of cards so we wouldn't be able to implement the tap and drag functionality otherwise we stick to using indexes to solve this issue but there would be the snapping you mentioned. I will look into it more though once I reproduce and see what I can do

Edit: I've reproduced it and I see the issue, will try and figure something out
Edit 2: Think I can use offset scroll with some decimal approximations to get it to work, should have it out tomorrow

@ShaanNarendran ShaanNarendran force-pushed the Scrollbar-Fix-2 branch 2 times, most recently from 4886586 to 2581ef4 Compare January 26, 2026 08:20
@ShaanNarendran
Copy link
Contributor Author

I implemented a fix but it's more of just a band-aid. We basically just use proportional scrolling rather than calculating pixels so it changes according to the size of the card, thereby making it smoother and not jumpy but in my testing there still is a little jump when you have very varied sizes.

@mikehardy mikehardy added Needs Review and removed Needs Author Reply Waiting for a reply from the original author labels Jan 28, 2026
@mikehardy mikehardy requested a review from criticalAY January 28, 2026 15:36
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

LGTM (from a code perspective), feel free to accept/reject comments, as I feel they're all subjective nitpicks

⚠️ I feel this needs a second physical test before merging

@david-allison david-allison added Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Jan 29, 2026
@ShaanNarendran
Copy link
Contributor Author

I think I really messed up the git in my branch..

@ShaanNarendran ShaanNarendran force-pushed the Scrollbar-Fix-2 branch 2 times, most recently from cd232df to f73206d Compare January 29, 2026 17:22
@david-allison
Copy link
Member

undo the 'merge' and rebase instead

@ShaanNarendran ShaanNarendran force-pushed the Scrollbar-Fix-2 branch 3 times, most recently from 902087b to 9351bff Compare January 30, 2026 02:26
@david-allison david-allison removed Needs Author Reply Waiting for a reply from the original author Has Conflicts labels Jan 30, 2026
@david-allison
Copy link
Member

My review still stands, Cheers!
Needs a quick fix to make CI happy

I'm going to unwatch this one, ping me if I'm needed

@ShaanNarendran ShaanNarendran force-pushed the Scrollbar-Fix-2 branch 2 times, most recently from fc1e468 to 1f12a3e Compare January 30, 2026 19:28
Fixes issue 20173.
Reverted the issue introduced in ca95728 by removing the conflicting onTouchListener added in 3c0b2bb.

# Conflicts:
#	AnkiDroid/src/main/java/com/ichi2/anki/ui/RecyclerFastScroller.kt
Copy link
Contributor

@criticalAY criticalAY left a comment

Choose a reason for hiding this comment

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

Ok! now I am happy, LGTM

@criticalAY criticalAY added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Feb 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The scrollbar can cause lag

5 participants