Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-113200

Improve Management Toolbar Creation Menu "More" button behavior



      While updating modal usages in journal-web, I stumbled upon quite odd code related to More button in Management Toolbar Creation Menu.

       Steps to reproduce:

      1. Control Panel > Site > Web Content > Structures tab
      2. Create 10 structures. Yes, 10. There probably is a config somewhere that can change this
      3. Web Content tab > create new web content on > More. Modal opens.
      4. Close modal on

      What happens is page refreshes, for seemingly no reason. I am not sure if this was done deliberately as a workaround, or it just hid the root issue.

      After I cleaned up the code, replacing modal with new `openModal` util, I got this behavior:

      • While modal is being opened, there is a flash of dropdown menu with all items.
      • After modal is closed, dropdown menu shows all items. There is no `More` button, until the page is refreshed. This is likely why we are refreshing page in the current code.

      The root cause is the code added in LPS-95665 , see more in COMMERCE-827. This is the commit.

       As Chema Balsas said here, we wanted this

      There's 2 courses of action not necessarily exclusive:

      • The proper functionality should be implemented in ddm so that the more button triggers the proper modal.
      • The dropdown menu should have a default behaviour of showing all the elements when the modal functionality hasn't been implemented.

      The problem is, both behaviors happen at once, if modal is implemented. `event.preventDefault();` was probably attempt to prevent list extending, but it doesn't work. The intended default behavior in `ManagementToolbar.es.js` executes first, or the order may be random.

      Possible solution directions:

      • Remove extend behavior and implement modal on Widget templates page
      • Add a mechanism that executes extension only if modal is not implemented. This may be some event handle override mechanism, I don't know how that could be implemented. It could also be something like attribute on button, determining if we are in modal or legacy mode.
      • We could keep the unfortunate page refresh workaround, and somehow find a way to prevent change flash while modal is opening.

      Carlos Lancha Chema Balsas What do you think?


          Issue Links



              brian.chan Brian Chan
              marko.cikos Marko Čikoš
              Engineering Assignee:
              Marko Čikoš
              Recent user:
              Brian Chan
              Participants of an Issue:
              0 Vote for this issue
              0 Start watching this issue




                  Version Package