Focus on Next Column Panel

I have a series of column panels in one of my pages. Users select a button in the top column panel and then a different panel shows up below.

But when the next column panel loads, it loads below and the user has to scroll down. I need to be able to highlight the next column panel so the users can see what’s next.

Thanks!!

1 Like

Hi Colette, have you tried scroll_into_view()?

In this example, I run this when the Button is clicked:

self.column_panel_2.scroll_into_view()

And the app scrolls to the bottom of column_panel_2:

https://anvil.works/build#clone:NBZFR7FKTPJZZHXO=AIIN2KYDLDJI34GUWGWRKMTJ

2 Likes

Hey! This works well most of the time, but some of my column panels are super big and when I use scroll to view it goes to the middle of the column (not the top).

Aha, that’s a bug, it should scroll to the top.

As a sort-of-workaround: If there’s a component at the top of your Column Panel that isn’t very high (such as a title Label), then you could scroll_into_view on that instead. The top of the Column Panel will then be in the middle of the browser window. Not perfect, but possibly better for now?

1 Like

scroll_into_view() still scrolls the component to the centre of the window. Is there a workaround for this yet?

1 Like