Author Topic: Scrolling bug when grid looses focus then gets it back  (Read 5901 times)

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Scrolling bug when grid looses focus then gets it back
« on: October 27, 2025, 11:30:03 pm »
I have an issue that if I scroll down the grid and lets say double clicka row causes a modal popup.  When the popup disapears, the grid scrolls to the top because the grid has regained the focus.

I have tried this with a right click context menu and the same things happens, once the grid regains focus, it scrolls to the top.

How do I prevent this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #1 on: October 28, 2025, 05:23:27 pm »
When grid is focused, browser tries to bring it to the center of screen.

Is there any grid focus API call upon close of dialog. If yes then please try removing it.

Please share a jsfiddle if your issue is not resolved.

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #2 on: October 30, 2025, 12:57:49 am »
If the grid doesn't have the focus when a temporary popup div appears then disapears, then all is fine, it is ONLY when the grid has the focus and the SAME div appears and the grid regains focus when it is hidden, pqGrid scrolls to the top.

There seems to be no gain or valid reason for doing this (no other grid does this), it only happens when it regains focus after losing it, which has nothing to do with centering it the page. 

If I click on the grid when it has scrolled, it doesn't scroll to the top row and lose it's scroll position.

This seems very much like a bug and I have many ways how to prevent it from happening, but as there are so many palces I use the grid and so many different popups, I will have to write code repeated times to circumvent what is obviously a bug or at least something I should be able to disable.
« Last Edit: October 30, 2025, 12:59:41 am by jplevene »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #3 on: October 30, 2025, 05:17:38 pm »
How exactly is it scrolling to the top? A JSFiddle would be greatly appreciated.

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #4 on: October 30, 2025, 06:59:35 pm »
Please can you give me a jsFiddle template.

I have the option:

selectionModel: { type:"row", mode:"single", column:false, all:false, toggle:false}, // Select rows
rowDblClick: function(event, ui) { $("#dialog").dialog("open"); },

It happens when above the dialog closes.  It also happens when I right click a context menu on the grid, but doesn't happen if the trigger was not the grid, like a button outside the grid.

If you post a jsFiddle template I will do it for you.  I used to have one but can't find it.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #5 on: October 30, 2025, 07:30:39 pm »
Please use this jsfiddle template: https://jsfiddle.net/61Lyzj9a/

jplevene

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 210
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #6 on: November 15, 2025, 01:15:40 am »
https://jsfiddle.net/jplevene/cbfpva32/8/

Scrol to the last row, double click the row then close the popup dialog
« Last Edit: November 15, 2025, 01:18:08 am by jplevene »

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #7 on: November 17, 2025, 09:09:58 pm »
Thanks for the JSFiddle. I'm moving this to the Bug Report board for review and resolution.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6552
    • View Profile
Re: Scrolling bug when grid looses focus then gets it back
« Reply #8 on: January 18, 2026, 12:20:44 pm »
this is fixed in v11.1.0