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?


  • Options

    Can you provide a repro? I can't reproduce it with the following:

    for (int i = 0; i < 100; i++)
    new TextBox().Dump();
  • Options

    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.

  • Options

    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.

  • Options

    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)

  • Options
    edited May 20

    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

    Util.AutoScrollResults = true;
    var query =
        from i in Enumerable.Range(0, 50)
        select new DumpContainer(new Button("Refresh"));
  • Options

    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.

Sign In or Register to comment.