Disable auto scroll to input focus when changing tabs
I'm using LINQPad to generate reports so I could analyze and take action on the data. Often I would have to jump between different scripts to compare and/or look up additional data while I do my analysis. I wrote the scripts so they utilize different LINQPad controls to make refreshing data or performing other actions as I view them.
However I noticed that I have to constantly scroll back to where I was previously before I changed tabs. Then I realized that LINQPad is focusing on the first input item on the page (be that a button, text box, or whatever). I don't want it to scroll off like that, I want to stay where I was.
Can this behavior be removed?
Comments
-
Can you provide a repro? I can't reproduce it with the following:
for (int i = 0; i < 100; i++) i.Dump(); new TextBox().Dump();
-
I'll try to reproduce with another example. The objects are actually complex objects that has a custom ToDump() method defined which dumps a mini UI of stuff.
-
Hmm, I can't reproduce it anymore. I had a session open for a long while (at least a couple of days) and I closed and reopened linqpad. The same scripts didn't cause it to happen again. I'll report back if it happens again. I don't think there was anything inherently in my scripts that would have caused it necessarily. Just analyzing video files and categorizing them and whatnot.
-
This is still occurring but I can't come up with a reproduction that I could share. It's processing files on disk and generating a UI to manipulate it utilizing ToDump and dump containers to be interactive.
In the meantime, I could add some observations with this bug, it only seems to happen when changing tabs by clicking on them on top. Using Ctrl+Tab to change tabs does not trigger the scroll/focus change. I do inject some tweaked scripts to the results page but none that should cause this.
https://share.linqpad.net/4uuxqos8.linq (doesn't repro but structurally similar to the script that does)
-
Just FYI, your script does show the issue for me but only if I hide the editor.
Which means the following also shows the issue
"Top".Dump(); Util.AutoScrollResults = true; var query = from i in Enumerable.Range(0, 50) select new DumpContainer(new Button("Refresh")); query.Dump(); "Bottom".Dump();
-
Got it. It seems that the browser automatically scrolls in this situation in order to accept focus. I'll add scroll position restoration logic to the next build.