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

Fancy crumbs and element action menus #13902

Merged
merged 68 commits into from
Nov 19, 2023

Conversation

brandonkelly
Copy link
Member

@brandonkelly brandonkelly commented Nov 2, 2023

High level: this redesigns control panel breadcrumbs, and unifies element action menus across edit pages, slideouts, and selectable element chips & cards.

Overview

  • Breadcrumbs have been redesigned to accommodate complex crumb UIs, including menus and chips.

The breadcrumbs for an Edit Entry page. The “Locations” section crumb now includes a menu, and the current entry is marked by a chip that includes the entry’s status indicator. The crumbs are followed by a context menu with “Current” selected, and an action menu trigger.

  • Entry and asset edit pages’ section and volume crumbs now include menus, making it possible to quickly navigate to another section or volume’s index source.

The breadcrumbs for an Entry Edit page, with its section crumb’s menu expanded, revealing options for each of the configured sections, and showing that “Locations” is selected.

  • Multi-site installs now include a site selector as the initial breadcrumb, on pages that need it.

The breadcrumbs for an Edit Entry page on a multi-site install, showing that the first breadcrumb is for the selected site. Its menu is expanded to reveal “English”, “French”, and “German” options, with “English” selected.

  • Page context menus have been moved into the global header beside the breadcrumbs.

The global header for an Entry Edit page, with its context menu expanded to reveal options for the current revision, active drafts, and recent revisions.

  • Elements can now define action menus, which will be displayed beside the breadcrumbs and context menu. These should include any actions that are unrelated to saving the content on the page.

The global header for an Entry Edit page, with its action menu expanded to reveal “View in a new tab” and “Delete entry” actions.

  • Element action menus also appear within element slideout headers, and selectable element chips & cards (with any destructive items omitted).

A selected asset within an Assets field, with its action menu expanded to reveal “Preview file”, “Download”, “View in a new tab”, “Edit asset”, “Replace file”, “Open in Image Editor”, and “Remove” actions.

Technical Details

  • Control panel screens can now include a site breadcrumb via CpScreenResponseBehavior::site(), and can make it a menu with additional selectable sites via CpScreenResponseBehavior::selectableSites().
  • Control panel screens can now specify an action menu via CpScreenResponseBehavior::actionMenuItems().
  • Control panel screens can now specify context menu items via CpScreenResponseBehavior::contextMenuItems(). contextMenuHtml() and contextMenuTemplate() have been removed in favor of that.
  • Elements can define their action menu items via safeActionMenuItems() and destructiveActionMenuItems().
  • Element action menu items can be customized via Element::EVENT_DEFINE_ACTION_MENU_ITEMS.
  • Elements can now define breadcrumbs via crumbs() (rather than prepareEditScreen()).
  • Menus can be added to any breadcrumb via a menu key, set to an array of menu options.
  • Disclosure menus can now easily be created throughout the control panel via craft\helpers\Cp::disclosureMenu().

Related

i-just and others added 30 commits July 31, 2023 11:17
…bar-menu

# Conflicts:
#	src/controllers/ElementsController.php
#	src/web/assets/cp/dist/cp.js
#	src/web/assets/cp/dist/cp.js.map
#	src/web/assets/cp/dist/css/cp.css
#	src/web/assets/cp/dist/css/cp.css.map
#	src/web/assets/garnish/dist/garnish.js
#	src/web/assets/garnish/dist/garnish.js.map
…bar-menu

# Conflicts:
#	src/web/assets/cp/dist/cp.js
#	src/web/assets/cp/dist/cp.js.map
# Conflicts:
#	src/controllers/ElementsController.php
#	src/templates/_includes/revisionmenu.twig
#	src/web/assets/cp/dist/cp.js
#	src/web/assets/cp/dist/cp.js.map
Copy link

linear bot commented Nov 16, 2023

ACC-7 Convert context menus to disclosure-type menus

IMPORTANT: This should only happen on the element pages, not on index pages/tables. This is because they cause a change of context instead of just loading new page content.

However, this could also be accomplished by breaking this out into two separate select components and adding a "Go" button.

Accessibility Requirements:

  • Create a disclosure menu so that it incorporates two separate select menus — one for site and one for version. (The current markup doesn't make sense from a screen reader user's perspective)
  • A distinct action button to trigger navigation to the selected version. This is because lack of an action button is a violation of On Input, unless there is a visible warning that a page redirect will occur when a selection is made.
  • The visible text of the disclosure trigger should be distinct from the selections, to ensure that the trigger text remains consistent across pages/versions/drafts (Consistent Identification).
  • The user's context should be apparent from:
    • The page <title> element
    • An indicator somewhere near the entry title (?)

brianjhanson and others added 4 commits November 16, 2023 13:27
[ci skip]
# Conflicts:
#	src/web/assets/garnish/dist/garnish.js
#	src/web/assets/garnish/dist/garnish.js.map
@brandonkelly brandonkelly merged commit 043cd79 into 5.0 Nov 19, 2023
@brandonkelly brandonkelly deleted the feature/cms-1213-fancy-crumbs-action-menus branch November 19, 2023 19:37
@theskyfloor
Copy link

This is beautiful, wanted this for years!

@alexanderloewe
Copy link

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants