The navigation drawer does not currently automatically close when you click a navigation link when it is in modal mode on small screens.
Here is a dirty workaround you can use in the meantime. I simulates a click outside the drawer, which triggers the drawer to close. I’m sure there are better ways to do it.
import time
from anvil.js.window import jQuery
def _close_navigation_drawer(self):
overlay = jQuery('.anvil-m3-navigation-drawer-scrim')
if overlay:
time.sleep(0.1) # so link is shown in selected mode
overlay.trigger('click')