Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backend menu gets too long and not generating proper columns #37812

Closed
1 of 5 tasks
digitalpianism opened this issue Jul 28, 2023 · 17 comments
Closed
1 of 5 tasks

Backend menu gets too long and not generating proper columns #37812

digitalpianism opened this issue Jul 28, 2023 · 17 comments
Labels
Area: Framework Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.4-p4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it

Comments

@digitalpianism
Copy link
Contributor

Preconditions and environment

  • Magento version 2.4.4-p4
  • Firefox
  • Having a first submenu containing more than 12 items.

Example : the first submenu of the Sales menu has got 13 items.

image

Steps to reproduce

  1. Access the backend.

Expected result

The system should add a column brake so the submenus are correctly displayed

Actual result

Unable to access submenus below the 12+ submenu because the column brake isn't behaving correctly.

Attached is a screenshot of the problem. I'm already scrolled down at the very bottom of the page and there's still items below "Shipments" and "Credit memos"

image

Additional information

I have investigated and managed to fix the issue with the following code. Problem comes from the fact that if the first submenu exceeds the hardcoded 12 items limit, the next submenu does not automatically include a column brake.

diff --git a/magento/module-backend/Block/Menu.php b/magento/module-backend/Block/Menu.php
--- a/magento/module-backend/Block/Menu.php
+++ b/magento/module-backend/Block/Menu.php
@@ -333,10 +333,16 @@ class Menu extends \Magento\Backend\Block\Template
         }
         $result[] = ['total' => $total, 'max' => ceil($total / ceil($total / $limit))];
         $count = 0;
+        $itemCount = 0;
+        $nextColBrake = false;
         foreach ($items as $item) {
+            $itemCount++;
             $place = $this->_countItems($item->getChildren()) + 1;
             $count += $place;
-            if ($place - $result[0]['max'] > $limit - $result[0]['max']) {
+            if ($nextColBrake) {
+                $colbrake = true;
+                $count = $place;
+            } elseif ($place - $result[0]['max'] > $limit - $result[0]['max']) {
                 $colbrake = true;
                 $count = 0;
             } elseif ($count - $result[0]['max'] > $limit - $result[0]['max']) {
@@ -345,6 +351,12 @@ class Menu extends \Magento\Backend\Block\Template
             } else {
                 $colbrake = false;
             }
+
+            $nextColBrake = false;
+            if ($itemCount == 1 && $colbrake) {
+                $nextColBrake = true;
+            }
+
             $result[] = ['place' => $place, 'colbrake' => $colbrake];
         }
         return $result;

Test evidence after fix :

image

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
@m2-assistant
Copy link

m2-assistant bot commented Jul 28, 2023

Hi @digitalpianism. Thank you for your report.
To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:


Join Magento Community Engineering Slack and ask your questions in #github channel.
⚠️ According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
🕙 You can find the schedule on the Magento Community Calendar page.
📞 The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, join the Community Contributions Triage session to discuss the appropriate ticket.

@m2-assistant
Copy link

m2-assistant bot commented Jul 28, 2023

Hi @engcom-Dash. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

    1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
    1. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
    1. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
    1. Verify that the issue is reproducible on 2.4-develop branch
      Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
      - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
      - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

@shikhamis11
Copy link
Member

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @shikhamis11. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Dash
Copy link

@magento give me 2.4-develop instance

@magento-deployment-service
Copy link

Hi @engcom-Dash. Thank you for your request. I'm working on Magento instance for you.

@magento-deployment-service
Copy link

@engcom-Dash engcom-Dash added the Reported on 2.4.4-p4 Indicates original Magento version for the Issue report. label Jul 31, 2023
@engcom-Dash
Copy link

engcom-Dash commented Jul 31, 2023

Hi @digitalpianism

Thank you for reporting and collaboration.

“Amasty Extension” that doesn't come along with latest / default Magento installation. Code of this package is not part of https://github.com/magento/magento2 git repository. We are not able to provide fix for it in this repository. All questions, issue reports and fix for them should be addressed to the corresponding extension owners(support) or the Magento Market place page

Thank you.

@engcom-Dash engcom-Dash added the Issue: needs update Additional information is require, waiting for response label Jul 31, 2023
@m2-community-project m2-community-project bot moved this from Ready for Confirmation to Needs Update in Issue Confirmation and Triage Board Jul 31, 2023
@engcom-Dash engcom-Dash removed the Issue: needs update Additional information is require, waiting for response label Jul 31, 2023
@m2-community-project m2-community-project bot moved this from Needs Update to Ready for Confirmation in Issue Confirmation and Triage Board Jul 31, 2023
@m2-community-project m2-community-project bot removed this from Ready for Confirmation in Issue Confirmation and Triage Board Jul 31, 2023
@digitalpianism
Copy link
Contributor Author

digitalpianism commented Jul 31, 2023

@engcom-Dash Hi there, I think there's a misunderstanding of the bug I reported. It has nothing to do with Amasty or any other 3rd party extension. The problem is only replicable if a first submenu contains more than 12 items.

Simple example with a custom module with the following adminhtml/menu.xml file :

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd">
    <menu>
        <add id="Package_Test::test1" title="Test 1"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test2" title="Test 2"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test3" title="Test 3"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test4" title="Test 4"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test5" title="Test 5"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test6" title="Test 6"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test7" title="Test 7"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test8" title="Test 8"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
        <add id="Package_Test::test9" title="Test 9"
             translate="title" module="Package_Test" sortOrder="100"
             action="test/test/test"
             parent="Magento_Backend::content_elements" resource="Magento_Cms::page"/>
    </menu>
</config>

image

I cannot access submenus below what you see in the screenshot.

It's definitely a Magento bug, I reckon it should be fixed (and I provided the fix)

@engcom-Dash engcom-Dash reopened this Jul 31, 2023
@m2-community-project m2-community-project bot added this to Ready for Confirmation in Issue Confirmation and Triage Board Jul 31, 2023
@engcom-Dash engcom-Dash removed their assignment Jul 31, 2023
@engcom-Dash engcom-Dash added the Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it label Jul 31, 2023
@engcom-November engcom-November self-assigned this Aug 30, 2023
@m2-assistant
Copy link

m2-assistant bot commented Aug 30, 2023

Hi @engcom-November. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue.
  • 3. Add Area: XXXXX label to the ticket, indicating the functional areas it may be related to.
  • 4. Verify that the issue is reproducible on 2.4-develop branch
    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
  • 5. Add label Issue: Confirmed once verification is complete.
  • 6. Make sure that automatic system confirms that report has been added to the backlog.

@github-jira-sync-bot
Copy link

✅ Jira issue https://jira.corp.adobe.com/browse/AC-9423 is successfully created for this GitHub issue.

@m2-assistant
Copy link

m2-assistant bot commented Aug 30, 2023

✅ Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

@engcom-November engcom-November added the Priority: P2 A defect with this priority could have functionality issues which are not to expectations. label Aug 30, 2023
@m2-community-project m2-community-project bot added this to Ready for Development in High Priority Backlog Aug 30, 2023
@digitalpianism
Copy link
Contributor Author

@engcom-November thanks for confirming. Note that I have included the fix in my first comment under the Additional Information section.

@hutychivan
Copy link
Contributor

@magento I am working on this

@hostep
Copy link
Contributor

hostep commented May 1, 2024

@engcom-November or @engcom-Dash: why did this got closed? There is no explanation. Was it fixed? Can you link to the commits that fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Framework Component: Ui Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Priority: P2 A defect with this priority could have functionality issues which are not to expectations. Progress: done Reported on 2.4.4-p4 Indicates original Magento version for the Issue report. Reproduced on 2.4.x The issue has been reproduced on latest 2.4-develop branch Triage: Dev.Experience Issue related to Developer Experience and needs help with Triage to Confirm or Reject it
Projects
Development

Successfully merging a pull request may close this issue.

7 participants