Scrollbars problem

Hi everybody.

I have a problem with scrollbars… I have horizontal scrollbar and also verticals(one or two, second one appears and disappears).
I’ve tried almost everything… removing components from top nav bar, removing left nav bar, removing center injected form - nothing helps.
And it started before I began to tweak theme.

Also I just don’t want to force hide scrollbars as they might be needed in some real occasions.

P.S.: I can share app clone link only with staff members or long time members through PM, can’t share it on open forum.
P.P.S: Theme will be shared with community as soon as I will finish it! ( + custom login/signup, + simple RBAC)

PLEASE help!!

1 Like

anybody? Somebody from Anvil team, please?

You’ve probably already seen this thread, but just in case: Vertical scroll bar issue below 991px min-width - #14 by apearce

Maybe you could go back in your version history to see when the scrollbars first appeared, to better understand which container is causing the issue?

(I don’t have the knowledge myself to be able to diagnose your situation.)

1 Like

Yeah, I saw that thread, thank you. But it didn’t helped me. Aslo tried to remove components - nope, nothing. Feels like something is wrong with body or main container…

1 Like

Just a quick thing you can try as a sanity check.

Take a copy of your current theme CSS.

Then replace it with the standard CSS.

It’s just a quick way to see if any theme changes you have made have unexpected consequences.

If the problem goes away then do a text compare to show differences and add them in one at a time until it breaks again.

If the problem is still there with the standard CSS then it would seem to be an Anvil issue.

4 Likes

Very good idea! Will try today and post.

@apearce , you were right! Seems like it’s a bug in Anvil theme? I’ve done like you told me - copied CSS from new project and still have exactly the same problem:

Anvil stuff, please help fix this…

Hello @briskspirit,

Seeing some code here would really help. If you can’t share the full app, can you build an app that demonstrates the problem and share that please?

2 Likes

Here is full app @ryan : Anvil | Login

1 Like

Hi @briskspirit

The issue here is that you are using form templates from the built-in Material Design theme within another top-level form (i.e. you add the BuyerForm form to the content panel on your RouterForm form). These templates will not work in that situation - they are designed to be used as top-level forms.

The recommended approach is to have a single top-level form based on one of the Material Design templates, and then add other forms to the content_panel on that form. The nested forms should be created from the Blank Panel template. You can read more about approaches for multi-page navigation here.

If you really want to make your app work with our standard template forms inside a ColumnPanel, which is the structure you have now, then you can set spacing_above and spacing_below to none for the RouterForm and its content_panel, and also set col_spacing to none. That should cause your nested page to fill the screen, removing the scrollbars. But, once again, I wouldn’t recommend this approach!

I hope that helps.

3 Likes

@daviesian , so hashrouter is not really redirecting to another form but loads it into it’s body?
In my case 3 pages for admin, buyer, seller should be completely different with different menus and top level elements. That’s why I chose this approach.
Also what if I change RouterForm to blank page template?

Thank you for your help!

You can do that with the hash routing, it just takes more work. Your main routing form is the full form, your “pages” use the blank template. In the init function for each of your pages you can use get_open_form () to get the outer form and then can call methods on it to change the contents of the sidebar links, top level elements, etc.

Any page that doesn’t change the sidebar, etc, just inherits whatever the last page set.

3 Likes

@jshaffstall I feel a request to contribute to the documentation.
A section - how to adjust the MainForm could be really useful. :wink:

Another approach might use the MainForm’s on_navigation to adjust its sidebar/navbar whenever the url_hash changes.

There is an example in the docs which adjusts the highlighted link based on the incoming url_hash.

GitHub - s-cork/HashRouting: HashRouting - a dependancy for anvil.works that allows navigation in apps

You could extend the example to change the nav-right, title and left-nav slots on the MainForm based on the url_hash

That’s fair. I’ll have to work up some code as an example that doesn’t depend on my own idiosyncratic navigation library, but I can work on that.

Edit: @briskspirit here’s a clone link that shows the technique I mentioned: Anvil | Login

It’s barebones, but you could extend the idea to hide links based on who is logged in, etc.

1 Like

Will quote @stucork 's direct message that helped in my case :

Continuing the discussion from Scrollbars problem:

Did you change the approach in the end?
If not then another way to make your main router completely blank might be to use an Custom HTML form as the main router, with no components. And in the init method do self.content_panel = self.
This came up in another context and it reminded me of your app.

I bet your approach is most suitable for my case, but I chose Anvil to be as lazy as possible and to build MVP asap :smiley:

1 Like

Found even more unusual way of doing this: Now I have 3 main routers for different roles :slight_smile: LoginPage is an entry point and it decides which main router form to open after successful auth. Bet I will have some interesting problems with this approach… but now it is the closest to what I tried to achieve - 3 different apps that use same components and components + server side will decide what to show and what to allow.