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

When no page is selected when administering (drag'n'dropping pages), the UI breaks

    Details

    • Fix Priority:
      4

      Description

      Reproduction steps:

      1. Start 7.1.x
      2. Login as admin
      3. Create test pages. (In my reproduction I created 4 public pages and 4 private pages)
      4. All settings remain default by all of them
      5. Go to pages, then change between private and public page list.
      6. when we first navigate to private or public page, there won't be any active page selected. (You can select a page by clicking on them, but to reproduce the issue don't select a page)
      7. If we try to drag'n'drop a page without selecting one. The UI breaks and the error message is shown

      Expected behavior:
      Drag'n'drop fails without js error and breaking the UI

      Actual behavior:
      The UI breaks and a js error is thrown in the browser's console.

      Reproduced with fix-pack-9
      Reproduced with fix-pack-11
      Reproduced with 7.1.x Commit: 70b82c079199b46abb67e8d62de9ac6e8f4322b0
      Can't reproduce on Master Commit: 3879117814dfcf04bb2e9748322497aeadf2e152

       

      Note:

      Inside LayoutGetUtils.es.js -> getColumnActiveItem(layoutColumns, columnIndex)

      activeItem will be undefined, as

      const activeItem = column.find(
      		(item) => item.active
      	);
      

      item.active will be false to every item(page). I was able to reproduce the issue, by:

      • changing between private and public page list.
      • when we first navigate to private or public page, there won't be any active page selected. You can select a page by clicking on them. This means when a page is dragged to the right column, it will be registered as a child page of the selected(active) page.
      • If we try to drag'n'drop a page without selecting one. The UI breaks and the error message is shown

      The error drops from LayoutDropUtils.es.js -> dropItemInsideColumn(layoutColumns, sourceItem, targetColumnIndex)

      const newParentPlid = getColumnActiveItem(
      		nextLayoutColumns,
      		targetColumnIndex - 1
      	).plid;
      

      getColumnActiveItem() will return an undefined activeItem, so we cannot read the plid value of it.

       

      On master  'dropItemInsideColumn(layoutColumns, sourceItem, targetColumnIndex)' won't get called when a page(item) is not selected.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              norbert.nemeth Norbert Németh
              Reporter:
              norbert.nemeth Norbert Németh
              Participants of an Issue:
              Recent user:
              Norbert Németh
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 26 weeks, 2 days ago

                  Packages

                  Version Package