Selecting row in table causes page scroll

  1. My goal: Fix issue/report possible bug
  2. Issue: I have a table that when selecting a row it runs certain queries. The issue is that when selecting a row it scrolls down to show queries loading. Table has no event handlers on row selection.
  3. Steps I've taken to troubleshoot: Check if any query has event handler, remove all event handlers in table.
  4. Additional info: This is fairly recent, it started a few months ago:

First photo, nothing selected. Showing empty states

Second photo: Scrolls down to component that relies on result from a query

I’m don’t know what that means, “scrolls to down to running queries”?

Sorry, it scrolls down to components that rely on results from a query but that query is still running so it shows the loading spinner for the query.

Are there any event handlers on any of the columns? Columns can have on click handlers. If it can’t be figured out, I would probably just drop in a new table and see how it acts after setting it up the same of the problem table.

Hey @Luis_Morales_Romero welcome to the Community! :smiling_face_with_sunglasses: How is it going? Are you still having trouble with this?

Hey @Luis_Morales_Romero, just wanted to follow up and see if you’re still running into this issue?

Yes, I’m still running into this issue!

Hey @Luis_Morales_Romero, welcome back! Some clarifying questions to help me narrow things down!

  • Are you on Retool Cloud? Or self-hosted? If self-hosted, which version?
  • Do any of your columns have event handlers?
  • Can you try to reproduce this bug in a new table?

Thanks!

Are there any event handlers on any of the columns? Columns can have on click handlers. If it can’t be figured out, I would probably just drop in a new table and see how it acts after setting it up the same of the problem table.old

Hello! According to the Retool AI it was because i was referencing table.selectedRow in a tabbed container for the hidden attribute. Once table.selectedRow was not blank it would mount the component (the tab) and because it mounts it would automatically scroll down to focus on the freshly mounted component. Apparently this is something native to retool and cannot be changed which is unfortunate because this causes unwanted behavior.

Hey @Luis_Morales_Romero thanks for waiting. You're right that this is native Retool behavior, when a component goes from hidden to visible (for example when it mounts fresh into the DOM), Retool automatically scrolls it into view. Since you were using table.selectedRow in the Hidden attribute, every row click triggered that mount and the scroll along with it.

The workaround that I can think of is to avoid the "hidden-to-visible transition" on row selection. The easiest way is to keep the container always visible but conditionally show its content. For example, display a placeholder like "Select a row to see details" when no row is selected, and swap in the real content once a row is selected. That way the container is always mounted and the auto-scroll never fires. What do you think?

Hey @Luis_Morales_Romero, following up again! I recently reproduced a separate but potentially related behavior, the Tabbed Container can sometimes cause the page to scroll vertically to the container on refresh. I've filed an internal ticket for it. Could you confirm whether your app uses any Tabbed Container components, and if so, whether you're also seeing this on refresh?

Yes I can confirm that my app uses tabbed containers.

Hey @Luis_Morales_Romero, thanks for confirming! I'm submitting your case as well, would you mind sending me a JSON export of your app so I can include it? Also, to clarify: when the page scrolls, does it scroll to the position of your Tabbed Container(s)?

Yes it does scroll to the position of the tabbed containers.

Thanks for clarifying, I'm submitting your case now, would you mind sending me a JSON export of your app so I can include it? @Luis_Morales_Romero