WordPress.org

Make WordPress Core

Opened 18 months ago

Closed 3 months ago

Last modified 3 months ago

#46367 closed enhancement (fixed)

Introduce a cancel button to the create new menu screen when 1 or more menus exist

Reported by: garrett-eclipse Owned by: audrasjb
Milestone: 5.5 Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-patch has-screenshots commit early
Focuses: ui, administration Cc:

Description

Hello,

On the create new menu screen it would be nice to introduce a Cancel link in the same location as the 'Delete Menu' link appears when editing a menu.

This would only make sense when there are one or more menus in existence, when there aren't any menus there's nothing to cancel. When there is a single menu and you go to create a new menu there's no indication on screen that a menu exists and you need to reload to be able to edit the existing menu. When there is more than one menu the select menu dropdown appears so at least you can switch menus to cancel.

The use case this helps the most is when there's only one menu and you click 'create a new menu'. In this case the cancel allows you to go back to the single existing menu.

Hope that was clear,
Thank you

Attachments (10)

Screen Shot 2019-02-27 at 10.10.48 PM.png (171.9 KB) - added by garrett-eclipse 18 months ago.
This screen shows the create menu screen when there's one existing menu. Nothing indicates a menu exists and there's no way to cancel or navigate back except with a reload.
Screen Shot 2019-02-27 at 10.15.48 PM.png (143.9 KB) - added by garrett-eclipse 18 months ago.
When there's more than one menu on the create a new menu screen you at least get the select a menu as a way to cancel the create action.
Screen Shot 2019-02-27 at 10.22.46 PM.png (56.3 KB) - added by garrett-eclipse 18 months ago.
Suggested ui addition of Cancel onto create new menu view
46367.diff (1.4 KB) - added by garrett-eclipse 15 months ago.
Initial patch - Introduces cancel-button to redirect back to nav-menus.php
46367.2.diff (1.4 KB) - added by garrett-eclipse 15 months ago.
Minor adjustment to original, moving the cancel-action conditional prior to the delete-action we can cleanup the if/elseif removing the ! $add_new_screen as we confirm that in the first condition
Screen Shot 2019-05-04 at 10.46.26 AM.png (67.0 KB) - added by garrett-eclipse 15 months ago.
Screen illustrating applied patch w/ 'Cancel' button. Colours in patch use same as 'Delete Menu'
46367.3.diff (1.4 KB) - added by audrasjb 6 months ago.
Patch refresh + small changes
453e1925ca9499ad3fd6f060f967a11f.gif (460.0 KB) - added by audrasjb 6 months ago.
Works fine
46367.4.diff (19.9 KB) - added by garrett-eclipse 6 months ago.
Updated patch to ensure 'Cancel' isn't introduced when no menus are available.
46367.5.diff (2.7 KB) - added by garrett-eclipse 6 months ago.
Update to remove the changes introduced in src/wp-includes/assets/script-loader-packages.php which were unintentionally included in my previous patch.

Download all attachments as: .zip

Change History (23)

@garrett-eclipse
18 months ago

This screen shows the create menu screen when there's one existing menu. Nothing indicates a menu exists and there's no way to cancel or navigate back except with a reload.

@garrett-eclipse
18 months ago

When there's more than one menu on the create a new menu screen you at least get the select a menu as a way to cancel the create action.

@garrett-eclipse
18 months ago

Suggested ui addition of Cancel onto create new menu view

#1 @audrasjb
15 months ago

  • Owner set to audrasjb
  • Status changed from new to reviewing

Hi @garrett-eclipse and thanks for the ticket :-)

I'm wondering what would be the best action triggered by the cancel button. Simply reload the current page?

@garrett-eclipse
15 months ago

Initial patch - Introduces cancel-button to redirect back to nav-menus.php

@garrett-eclipse
15 months ago

Minor adjustment to original, moving the cancel-action conditional prior to the delete-action we can cleanup the if/elseif removing the ! $add_new_screen as we confirm that in the first condition

@garrett-eclipse
15 months ago

Screen illustrating applied patch w/ 'Cancel' button. Colours in patch use same as 'Delete Menu'

#2 @garrett-eclipse
15 months ago

  • Keywords has-patch has-screenshots needs-testing added

Hi @audrasjb thanks for the ping.

Reviewing the setup WP has, the create menu redirects the user to nav-menus.php?action=edit&menu=0 so taking the user back to nav-menus.php seems like the most appropriate course here.

I setup an initial patch for this in 46367.diff (and minor tweak in 46367.2.diff to cleanup the conditional), which introduces the menu-cancel action link. To give it the same red as the menu-delete action I've added the selector to the common.css file where menu-cancel is setup. I'm not sure if we want to give it an alternate colour but felt it made sense and should never appear alongside the menu-delete action.

Give it a shot and let me know if you have any issues.

All the best

Last edited 15 months ago by garrett-eclipse (previous) (diff)

#3 @garrett-eclipse
6 months ago

  • Milestone changed from Awaiting Review to 5.4

Hi @audrasjb retesting the patch applies cleanly still on trunk and resolves the issue enabling users to cancel out of the create menu screen gracefully. I've moved this to 5.4 to get some testing and hopefully move this forward. Cheers

@audrasjb
6 months ago

Patch refresh + small changes

#4 @audrasjb
6 months ago

  • Keywords commit added; needs-testing removed
  • Status changed from reviewing to accepted

Hi @garrett-eclipse

I refreshed the patch. I tested it (see screenshot above) and it works fine.

I think the patch is definitely good to go. Adding commit keyword.

Thanks,
Jb

#5 follow-up: @SergeyBiryukov
6 months ago

  • Milestone changed from 5.4 to 5.5

46367.3.diff looks good, but it appears to display the Cancel link even when no menus are created yet, which just leads to the same screen. To make sure the logic is correct, let's move to early 5.5.

#6 @SergeyBiryukov
6 months ago

  • Keywords early added

@garrett-eclipse
6 months ago

Updated patch to ensure 'Cancel' isn't introduced when no menus are available.

@garrett-eclipse
6 months ago

Update to remove the changes introduced in src/wp-includes/assets/script-loader-packages.php which were unintentionally included in my previous patch.

#7 in reply to: ↑ 5 @garrett-eclipse
6 months ago

Replying to SergeyBiryukov:

46367.3.diff looks good, but it appears to display the Cancel link even when no menus are created yet, which just leads to the same screen. To make sure the logic is correct, let's move to early 5.5.

Thanks @SergeyBiryukov good catch. I've corrected this in 46367.5.diff to suppress the Cancel link when no menus are present.
*Note: Please ignore 46367.4.diff there was some unintended changes to the src/wp-includes/assets/script-loader-packages.php file.

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


4 months ago

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


4 months ago

This ticket was mentioned in Slack in #core by david.baumwald. View the logs.


3 months ago

#11 follow-up: @SergeyBiryukov
3 months ago

46367.5.diff looks good.

I would suggest not using the red color for the Cancel link though, as it's generally used for destructive actions: Delete, Trash, Spam, etc. An empty menu has no data yet, so the Cancel link is not really destructive.

#12 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 47770:

Menus: Add a Cancel link to the screen for creating a new menu.

The use case this helps the most is when there's only one menu and you click "create a new menu". In this case the Cancel link allows you to go back to the single existing menu.

Props garrett-eclipse, audrasjb.
Fixes #46367.

#13 in reply to: ↑ 11 @garrett-eclipse
3 months ago

Replying to SergeyBiryukov:

I would suggest not using the red color for the Cancel link though, as it's generally used for destructive actions: Delete, Trash, Spam, etc. An empty menu has no data yet, so the Cancel link is not really destructive.

Thanks @SergeyBiryukov good point, I appreciate that you omitted the css in the commit.

Note: See TracTickets for help on using tickets.