Problem/Motivation
Currently the Top Bar renders the the local tasks. But there is no logic, order or even an standardized way to add elements to it.
Proposed resolution
- Provide 3 delimited regions where UI elements will be hooked and rendered.
- Refactor how the existing local tasks are rendered so they used the standardized system created in this issue.
The three delimited regions are inspired by current designs for the top bar:

- Tools: Editorial tools, for instance pictured is a device switcher to aid in previewing content
- Context: Contextual information including the title and publish status of the content
- Actions: Actions to take on the content. Local tasks present in the Navigation top bar should be initially placed here, to be further refined in follow up issues.
Remaining tasks
User interface changes
None
Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #27 | top-bar.png | 6.05 KB | m4olivei |
Issue fork drupal-3484564
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
plopescWorking on the definition of the 3 new areas.
Comment #3
plopescComment #7
plopescInitial round to define the new TopBar render element and the plugin system to define top bar items.
We can iterate from here if the approach is considered valid.
Comment #8
nod_Conceptually I don't see an issue. The fact that it's not editable makes sense.
on the PHP implementation i'm not the best person to comment, just pointing out that the region names feels a bit magic, if we're really tryin to enforce the 3 areas i'd use an enum or something a bit more restrictive (and maybe easier to document).
As it is contrib can add anything fairly easily, and i'm not sure it's a feature or not. maybe it's missing wrappers and minimum styling too?
Comment #9
plopescGood point about the enum!
Created and used it as part of
TopBar::preRenderTopBar(). Tried to use the enum in the twig template as well, but it was not possible, given that enum support in Twig has been added recently and will not be available until 3.15. Core is now using Twig 3.14.See https://twig.symfony.com/doc/3.x/functions/enum.html & https://github.com/twigphp/Twig/pull/4352
Regarding the styles, some basic styling is needed. Hopefully a more experienced FE dev could help here.
Comment #10
nod_Let's get some minimal styling going on. just some barebone flexbox layout to replicate the positioning we can see #3484600: Show entity information on the Top Bar
Comment #11
finnsky commentedThis issue has POC with styles required
https://www.drupal.org/project/drupal/issues/3401826
Comment #12
catchLeft a (slightly drive-by) review on the MR.
Comment #13
kunalkursija commentedI tried applying the patch today to see what functionality is being added. Unfortunately, The patch is failing to apply.
Navigation.moduleseems to be having conflicts.Comment #14
kunalkursija commentedTried out the MR, This seems to be a solid way of defining the top bar elements. Thanks @plopesc!
Comment #15
finnsky commentedI'm not really sure how to apply styles to nothing :)
Could you please add some test cases?
Comment #18
plopesc@finnsky We only need the very basic styles to define the 3 regions:
Currently, only Actions has any content, the "More Actions" dropdown in entity pages.
Comment #19
nod_we can add markup for this
Comment #20
m4oliveiI also see that the local tasks are not rendering with the latest changes. Looks like we need to update the
top_bartheme hook to be arender elementtype and probably do some preprocess.I'll can work on that, as well as adding some basic styles.
Comment #21
m4oliveiI've addressed the issue that was preventing local tasks from showing up where appropriate. I've also addressed adding some markup to get local tasks over to the right-hand side. There were already some grid styles in place for that. That can probably be further improved in follow-ups.
I'm looking at the failing test ATM.
Comment #22
m4oliveiTest is green. Ready for review.
Comment #23
m4oliveiComment #24
finnsky commentedApplied styles.
Comment #25
plopescAll the comments by core committers were addressed and the basic styles implemented, I think this one can be marked as RTBC.
Comment #26
catchIt would be useful if the issue summary could say:
1. What the three top bar items are
2. However they're being defined (quick look at the MR looks like plugins, but then I checked the issue summary and didn't see a mention).
If we're expecting contrib modules to interact with these (I think we are?) then a change record would good too.
Comment #27
m4oliveiI've updated the issue summary per #26.
Will work on a CR as well.
Comment #28
m4oliveiCR written: https://www.drupal.org/node/3489732
Removing the relevant tags.
Thanks for the suggestions @catch.
Comment #33
nod_Committed 3ef3cfe and pushed to 11.1.x. Thanks!
Cherry pick is not clean on 10.5.x, need a MR for it
Comment #34
wim leersHow will the https://www.drupal.org/project/experience_builder React-powered UI be able to reuse this "Top Bar"? 🤔
Comment #35
finnsky commentedProbably some Microfrontends with common context. Just brainstorming. I don't have lot info about ExB.
https://dev.to/nik-bogachenkov/building-micro-frontends-with-vite-react-...
Comment #36
lauriiiXB won't use this directly (inside XB). This is simply partially driven by needs from Drupal CMS and XB to bring continuity between the Drupal UI and XB (by making changes to the Drupal UI).
Comment #37
finnsky commentedThen yeah. We have tiicket to backport all to sdc
Comment #38
catchComment #40
nod_per thread on slack we're not backporting the top bar work to 10.x, closing this one
Comment #41
nod_