verbb / navigation

A Craft CMS plugin to create navigation menus for your site.
Other
90 stars 22 forks source link

'A server error occurred' when scrolled down #399

Closed stephenheron closed 1 month ago

stephenheron commented 1 month ago

Describe the bug

Hi,

We have noticed an issue that when scrolled down on the edit menu page and you attempt to add a menu item you get a message that states: 'A server error occurred'.

https://github.com/user-attachments/assets/c871e7bd-3380-49d4-8ffc-5a1e264d4d6b

The issue is in fact not a server side issue but an issue on the client side, when the error occurs a JS error is produced:

image

And this is the offending line (BaseElementIndex.js:1657): const maxScrollTop = this.$main.offset().top - headerContainerHeight;

The issue appears to be the fact that on the menu edit page, there is not an element with the class 'main' which is what 'this.$main' is meant to refer to. If I modify 'src/templates/navs/_build.html' and add a main class:

image

The issue then resolves itself and once a menu item is added the browser jumps back to the top.

https://github.com/user-attachments/assets/c546bf3e-774f-4bf5-9e20-19976d2ea173

Steps to reproduce

  1. Start editing a menu
  2. Scroll down so that the 'sticky bar' appears
  3. Add menu item

Craft CMS version

5.2.6

Plugin version

3.0.2

Multi-site?

No

Additional context

No response

engram-design commented 1 month ago

Fixed for the next release. To get this early, run composer require verbb/navigation:"dev-craft-5 as 3.0.2".

engram-design commented 1 month ago

Fixed in 3.0.3