Problem/Motivation
The Navigation module provides the top_bar theme hook and
top-bar.html.twig. The Admin theme overrides it with
templates/navigation/top-bar--default-admin.html.twig, selected by an
unconditional top_bar__default_admin suggestion in
ThemeSuggestionHooks::themeSuggestionsTopBarAlter(). The suggestion always
applies, so it duplicates the template override that Drupal already resolves for
the active theme.
Proposed resolution
- Remove
themeSuggestionsTopBarAlter()fromThemeSuggestionHooks. - Rename the template to
top-bar.html.twig. - Document the available variables in the template docblock.
Preprocessing uses hook_preprocess_top_bar, the base hook, so it is
unaffected. No other core code references the top_bar__default_admin
suggestion. The Admin theme is experimental, so no deprecation is added.
The landmark and accessible name for the top bar are handled in #3583486. The
rendered markup does not change here.
Remaining tasks
- Review.
User interface changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | dom.PNG | 15.94 KB | angel_devoeted |
| #16 | top-bar.PNG | 21.62 KB | angel_devoeted |
Issue fork drupal-3621157
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:
- 3621157-admin-theme-should
changes, plain diff MR !17022
Comments
Comment #2
f0ns commentedComment #3
f0ns commentededit
Comment #5
f0ns commentedComment #6
f0ns commentedComment #7
kentr commentedComment #8
f0ns commented@kentr, thanks I was not aware of this [Meta] issue.
Comment #9
kentr commentedChanging it to
asideand restoring theh3is covered by #3583486: Adjust default_admin's top bar to the landmark used with the navigation module, which precedes this issue.Let's just fix the duplicate template override in this one.
Comment #10
kentr commentedComment #11
f0ns commentedMy bad, I wasn't aware of #3583486. I removed the landmark changes from the MR and left them to that issue.
This one now only removes the suggestion, renames the template and documents the variables.
Comment #12
f0ns commentedComment #13
ironnuts commentedRe: #12 f0ns can I please confirm that the 3x remaining tasks in the IS have been done? edit: Do you need to update those? Also #9 seems to have limited the scope of this issue. Do you need to update the IS to reflect the reduced scope? This will help me review the issue.
Comment #14
f0ns commentedComment #15
f0ns commentedYou are right! My bad, I forgot to update the issue description accordingly.
Fixed that.
Comment #16
angel_devoeted commentedTested
MR !17022on Tugboat and reviewed the code.I verified in the UI using the Default Admin theme that the top bar renders properly without any layout regressions.
Checked the DOM structure as well. Breadcrumbs, context, and actions render cleanly in their respective regions.
The code changes look solid.
Looks good to me.
Comment #17
ironnuts commented+1 to the review by angel_devoeted but there is not test coverage. The general rule is bugs need test coverage. Unless there is a special reason not to?
Comment #18
f0ns commentedI don’t see what could be tested / add value based on the commit.
Feel free to explain or help
Comment #19
ironnuts commentedThanks f0ns. Ok I will run with that.
Comment #20
kentr commentedIn cases like this I find tests helpful to confirm that the change doesn't cause a regression. For example, automated versions of the DOM checks that @angel_devoeted did in #16.
Though this may be covered already by the theme's existing tests or #3618216: Add automated tests to Default Admin. In this case I'd say it's up to the maintainers / committers.
Comment #21
ironnuts commentedThank you, kentr. +1.
Comment #22
quietone commentedChecking that the the core gates are passed.
I've updated the title per Title guidelines.
I've moved the Related issues from the Issue Summary to the 'Related issues link' field.
I read the MR, not a code review, and can confirm the add comments are correct. The only question here is if a test is needed, see #20. Manual testing was done in #16.
Comment #23
jurgenhaas+1 RTBC
Comment #28
catchNice to get rid of the unnecessary hook implementation. Committed/pushed to main, 12.0.x ,11.x and 11.5.x, thanks!