Menu button does not show menu once collapsed

Using anvil server on local machine and having the app that uses new slot functionality for the forms template the menu button doesn’t show the menu when its collapsed:

It works fine when hosted on Anvil cloud.
It works fine when hosted on local server and running the app on mobile device.
It doesn’t work when hosted on local server and running the app on pc web browser.

Once the hamburger button is clicked it collapses the menu but another click does nothing, the menu stays collapsed.

Is this some known bug when hosting locally?

Hey guys, bumping up this thread.
Did no one else experience this so far?

Hi @gp2! I think you’re question is lacking a bit information for people to feel confident to respond.

Here is a guide on what information would help:

Really? I thought there is enough info provided. Maybe the reason is not so many guys host the server themself and do not have yet many apps that uses new layout feature that got introduced recently.

1 Like

That might be it! I think, especially with new features, a sample application or code snippet could speak to the application of your slots.

ezgif-5-85dd7c1fd9
Right hand side hosted on Anvil, works as expected.

  • First click on hamburger button and menu collapses, another click it expands.

Left hand size hosted locally using Anvil App Server (latest version 1.10.1. tested on different operating systems: Ubuntu and Windows, and multiple different web browsers).

  • First click on hamburger button and menu collapses, another click and nothing happens.

I hope now its clear whats the issue :slight_smile:

1 Like

You could add a custom button to open and close your sidebar like so

This will do two things:

  1. Potentially be a work-around until you resolve the underlying issue
  2. Reveal if the issue is in the conditional statement checking if the left-nav element exist or in the showSidebar function.
  $('.sidebar-toggle, .nav-shield').off('click').on('click', function() {
    var ln = $('.structure > .nav-holder > .left-nav');
    if (ln.is(":visible") || $('.nav-shield').is(".shown")) {
      hideSidebar();
    } else if(!ln.is(":empty")) {
      showSidebar();
    }
  });

Ok, so the custom button you proposed works as expected when added to my app.
Why the built in hamburger button does not?

That, to me , suggestion something about your local version is not removing the left-nav element from the DOM when hiding the side bar because that is the logic that triggers the showSidebar() function.

You could add logic to the html, similar to the custom button that updates a flag as well, as a work around, although it’s much less dynamic. I’m not sure the root cause though.

I can submit this as a bug in the github repo for the anvil app server but I would like to be sure more people are experiencing same issue when hosting locally apps with new layout feature.

Just to add old type of apps without that “slot” functionality work as expected when hosted locally.

1 Like

I’m having some major issues with this new version. The app relies on anvil_extras. Everything works as expected on NEW version if hosting via anvil. The anvil app server fails miserably. I have forms that are out of place, I have many components that should be invisible showing up (and vice versa). The scaling does not match what I have in the anvil-hosted version. The one way to fix is for me to manually go into the anvil.yaml file and change the version to “2” and comment out the legacy features line. Everything else works as expected when I do this (including the hamburger menu correctly expanding/collapsing the side menu).