super_editor icon indicating copy to clipboard operation
super_editor copied to clipboard

Demonstrate issue where `SuperTextFieldInspector.findScrollOffset()` value is incorrect

Open CillianMyles opened this issue 1 year ago • 5 comments

As requested in a previous PR: https://github.com/superlistapp/super_editor/pull/2139#discussion_r1717331822

This PR demonstrates that the value of SuperTextFieldInspector.findScrollOffset() is incorrect sometimes after vertical scrolling on mobile.

I guess maybe this comment might contain a clue: https://github.com/superlistapp/super_editor/blob/main/super_editor/lib/src/super_textfield/infrastructure/text_scrollview.dart#L523-L537

CillianMyles avatar Aug 19 '24 08:08 CillianMyles

cc/ @matthew-carroll

CillianMyles avatar Aug 19 '24 08:08 CillianMyles

I see that you added a number of expectations. I assume they all fail? What values are each of them reporting?

matthew-carroll avatar Aug 26 '24 23:08 matthew-carroll

@CillianMyles ping on the earlier review questions

matthew-carroll avatar Sep 14 '24 17:09 matthew-carroll

@CillianMyles I ran into this issue while working on https://github.com/superlistapp/super_editor/issues/2316, but I'm not sure if it's the same issue you are facing.

It seems that sometimes the TextScrollController and the ScrollController can be out of sync. In my case, the ScrollController was being restored from page storage. I changed SuperTextFieldInspector.findScrollOffset() to read from the ScrollController instead of the TextScrollController and it fixed the test method. We still have the problem of the two controllers being out of sync though...

angelosilvestre avatar Sep 17 '24 02:09 angelosilvestre

@angelosilvestre I assigned this to you so that you can dig further into the root cause after we decide what to do about restoring the scroll offset.

matthew-carroll avatar Sep 22 '24 19:09 matthew-carroll