Steps to reproduce

  1. Install navigation module
  2. Navigate to a page with the top bar (like a node)
  3. Note that the left toolbar does not extend all the way to the bottom of the viewport.

Height issue

Proposed resolution

Remove the line of CSS that's causing the issue.

Some context

What is Drupal.displace() and how does it work.

Drupal.dispace() is a JS function that looks for attributes like data-offset-top, data-offset-left, etc. These are meant to be used by "sticky" position: fixed admin UI elements. And if used properly, will inform the front-end code how to properly place itself on the top of the page. For example, we don't want a fixed header to obscure the admin toolbar (or vice-versa).

So when Drupal.displace() is ran, it'll look for those data-offset properties, return the object, and also update those CSS vars that you're seeing.

(I should really turn this into a blog post).

Anyway, since the navigation's toolbar is fixed to the top, we definitely want that attribute on it.

Why was that line of CSS introduced?

To be honest, I might have done that back in the day (it looks like something that I would have written). When this was written, the top bar did not yet exist. And even though that didn't exist, there are other top bars (e.g. the old workspaces UI). So we needed to accommodate that.

For the Navigation module, the left toolbar is expected to go full height -- even if the the top bar exists. So the fix is simple. We need to just remove the one line of CSS.

Issue fork drupal-3531516

Command icon 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

f0ns created an issue. See original summary.

f0ns’s picture

I've added the css to fix this:

https://git.drupalcode.org/issue/drupal-3531516/-/commit/8fda91d0d4805a5...

I've patched my sites with it and everything works as expected now.

f0ns’s picture

Status: Active » Needs review
pierregermain’s picture

StatusFileSize
new85.97 KB

Hello,

I was able to reproduce the visibilty error visiting the /user/1 page Screenshot:
Screenshot

After testing on Gitpod using Drupal 11.2.1-dev and applying height: 100% from the patch provided makes the navigation bar correctly take up the full height.

Only local images are allowed.

I think this fix is ready for a merge request.

pierregermain’s picture

I’ve tested the patch on various admin pages, and it works as expected.
Many thanks to f0ns for the fix!

f0ns’s picture

Thank you for testing, i’ll leave it on needs review for now and see if we can have an extra pair of eyes on this one.

cilefen’s picture

It would be ideal to know which commit caused this.

xjm’s picture

Status: Needs review » Needs work

Thanks @f0ns. Your issue fork seems to be out of sync or perhaps created against a different source branch. Can you create a branch and merge request containing only the commit for your fix? Thanks!

f0ns’s picture

Status: Needs work » Needs review
f0ns’s picture

@xjm it should be fixed now. Thanks!

smustgrave’s picture

Version: 11.2.x-dev » 11.x-dev
sandip’s picture

StatusFileSize
new268.03 KB
new235.36 KB
new219.01 KB

I go though the issue and got that this issue is occured beacuse of block-size: calc(100vh - var(--drupal-displace-offset-top, 0px)); see the codebase link Code Link in line 95. In olivero frontend theme --drupal-displace-offset-top is set to 64px that's why navigation bar height is not getting 100%. In claro Admin theme i saw that --drupal-displace-offset-top is set not defined so we can see full height of navigation bar in claro. I am attaching images for clarity. Please share your thoughts.

sandip’s picture

I think may be we can remove the line block-size: calc(100vh - var(--drupal-displace-offset-top, 0px));

Before:

@media (min-width: 64rem) {
  .admin-toolbar {
    block-size: calc(100vh - var(--drupal-displace-offset-top, 0px));
    transform: none;
    inset-block-start: 0;
  }
}

After:

@media (min-width: 64rem) {
  .admin-toolbar {
    transform: none;
    inset-block-start: 0;
  }
}
f0ns’s picture

You might be right, I did not notice this css at first.

I’ll test this and get back on this.

f0ns’s picture

Status: Needs review » Needs work

f0ns’s picture

Status: Needs work » Needs review
f0ns’s picture

The suggestion indeed also fixes the problem and seems to me that this is a better solution (delete one line of CSS instead of adding one line of CSS).

Please review!

neptune-dc’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.19 MB
new1.07 MB

I was able to visually confirm the patch successfully fixes the height of the navigation bar by visiting `/user/1`

I agree that this solution that deletes css is the superior fix.

I have added screenshots as evidence.

catch’s picture

Status: Reviewed & tested by the community » Needs review

It would be good to check which issue added that line of CSS and whether it was added to fix a specific issue (or if it's not clear why it's there in git blame, e.g. added without comment as part of a larger change).

sandip’s picture

I saw this line is introduced in this issue queue https://www.drupal.org/project/drupal/issues/3484564. Here is the MR -> MR Link.

But it is not clear to me what issue it was fixing by decreasing the height from 100vh. Can you please look into it.

godotislate’s picture

f0ns’s picture

I think it depends on how you see the sidebar vs the topbar.

Since the sidebar holds the logo I personally feel it should always be 100% height and the header shouldn't overlap it or push it down because the logo wouldn't be in the lefthand top corner in this case which feels visually weird.

godotislate’s picture

Per @finnsky on Slack, the regression actually came from #3526266: Navigation top bar should utilize Drupal.displace().

finnsky’s picture

Maybe it's not. :)
I'm not sure right now.

The top bar was added in a hurry and we need to review how it works with displace

catch’s picture

@f0ns that seems to be the behaviour already, the top bar starts from the right edge of the sidebar for me.

f0ns’s picture

Then I can’t think of a case where you need to calc the height dynamically where it’s not 100% of the height for the sidebar.

svendecabooter’s picture

I can confirm the fix in MR 12461 restores the height of the navigation sidebar.

f0ns’s picture

Status: Needs review » Reviewed & tested by the community
benjifisher’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests
Related issues: +#3526266: Navigation top bar should utilize Drupal.displace()

I tested with the current 11.x and reproduced the problem.

Then I reverted 6bdfd060b136 (the commit from #3526266: Navigation top bar should utilize Drupal.displace(), 2025-06-04). I re-tested, and the navigation section (admin toolbar) had full height. That is two days later than #3526180: Regression: Drupal.displace() not working on new Navigation module in 11.2, so I think it is fair to say that #3526266 caused this bug, confirming Comment #28. I am adding #3526266 as a related issue.

I am setting the status to NW for some automated tests. Otherwise, we will have to go through the same arguments and similar research the next time this feature gets broken. I notice the comment #3526180-8: Regression: Drupal.displace() not working on new Navigation module in 11.2:

Note that I don't test out displace's functionality (that gets tested in its respective tests), I just test that the attribute is added properly, which is what the JS in this module does.

This time, can we get a functional test? That is, figure out the various combinations of window size, top bar, and navigation area, and confirm that things fit together the way we want them to?

@finnsky:

The top bar was added in a hurry and we need to review how it works with displace

Is there already an issue for that? If so, it would help to add it here as a related issue.

benjifisher’s picture

By the way, #3526266 changes markup (core/modules/navigation/templates/top-bar.html.twig) as well as CSS. Let's consider both before making further changes to the CSS.

sandip’s picture

@benjifisher, I tried reverted the commit from https://www.drupal.org/project/drupal/issues/3526266 and finds out that the issue caused this height bug.

Now after testing i came to know in this issue data-offset-top attribute is added in aside tag in top bar's twig file MR Link Issue #3526266. Because of that attribute --drupal-displace-offset-top along with other left, right and botton displace offset value is initialized and this is why the sidebar block-size: calc(100vh - var(--drupal-displace-offset-top, 0px)); it's height is reducing from 100vh.
Instead before this issue https://www.drupal.org/project/drupal/issues/3526266 --drupal-displace-offset-top was undefined as data-offset-top was not added as an attribute in Top Bar's aside tag, so we were getting full height 100vh of the sidebar.
Now i dont know how data-offset-top is related to --drupal-displace-offset-top but this are the things i mentioned above that i noticed.

I think that is the thing for which the height issue occurs due to that issue #3526266 commit. @benjifisher, Could you please share your thought on this.

finnsky’s picture

The issue seems more deeper that just height, but about behaviour of Drupal Displace globally
When workspaces enabled we have top displace calculated wrong
https://gyazo.com/52b598ad2bac75476ccc48d88e4ad98c

finnsky’s picture

1. Removed
{% if tools or context|render or actions|render %}
We have css for it. We may avoid it.

2. It is currently impossible to provide a shift of the toolbar and top bar together with displace offset top.
Therefore, let it always be aligned to the top of the screen
The drop-down popover accordingly too.

Workd good even with workspaces. Please review.

finnsky’s picture

Status: Needs work » Needs review

finnsky changed the visibility of the branch 3531516-admin-toolbar-height to hidden.

sandip’s picture

After this MR --drupal-displace-offset-top is undefined now. Now i found another regression due to that. Hamberger Icon and Search Box gets overlapped now as there is a regression in border-top-width property applied in .header-nav. I am attaching before and after image.

Before MR:
Img

After MR:
Img

Maybe we have to adjust border-top-width of .header-nav without --drupal-displace-offset-top

finnsky’s picture

I don't think we need to test Olivero theme here, it is outside of that issue scope.

sandip’s picture

@finnsky, Thank you for the clarification, I tested the MR and it fixes the issues correctly. I am attaching images for better understanding.

grimreaper’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new40.11 KB
new40.03 KB

Hi,

Thanks @finnsky.

I have tested MR https://git.drupalcode.org/project/drupal/-/merge_requests/12843, it fixes the issue.

Changing to RTBC as the test failure in the pipeline seems unrelated.

benjifisher’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs issue summary update

I am setting the status back to NW for an update to the issue summary. I already added the missing elements from the standard outline. Please

  1. Fill in the "Proposed resolution" section. (See below.)
  2. Add screenshots to the Before and After sections under "User interface changes". Probably you can use the screenshots attached to Comment #44 or #45.

That will make it a lot easier for others to review your work on this issue.

I would still like to see some automated tests, as I said in Comment #34, but I will not insist on that. I guess the navigation module is still experimental (especially the top bar).

From the MR, I see that you

  • replaced the block-size and inset-block-start calculations with fixed values 100vh and 0
  • changed the top bar (in some cases) from display: block; to display: flex; and replaced margin with padding
  • removed the {% if ... %} ... {% endif %} around the <aside> element in a Twig file, and removed the data-offset-top attribute.

I can see what was changed, but the issue summary should explain the intention behind those changes.

catch’s picture

I'm not sure what tests would look like for this (that would actually prevent the regression) except for visual regression tests that we don't have a framework for. If someone does, it would be great to add them here. If there's not a good way to add tests, we should open an explicit follow-up to add them later and add it to the navigation stable meta somewhere.

rkoller’s picture

testing MR12843, the shift of the footer region is being fixed, but the problem @finnsky highlighted in #37 still persists and the expanded workspaces popup making the workspaces menu item button and the shortcuts menu items inaccessible while the popup is expanded. do i understand #39 correctly and workspaces popup covering parts of the navigation sidebar is impossible to fix at this point?

catch’s picture

I can't find the core issue, but #3457688: Support for core navigation module has notes for a redesigned workspaces/navigation integration. So if this MR fixes other things but not workspaces, we should probably go ahead here and then fix workspaces in that issue (or open it if it doesn't exist).

f0ns’s picture

The fix doesn't apply anymore in the latest upgrade to Drupal 11.2.5, I'll look into it.

EDIT: all fixed, the issue was not related with this patch it was the first in a series of patches that was hanging because of another external problem. All fixed now.

finnsky’s picture

I see main issue that offcanvas JS
https://git.drupalcode.org/project/drupal/-/blob/11.x/core/misc/dialog/o...

not allows to set multiple top displacers.
https://gyazo.com/d598a5fdfad8d8ac8b6a2e415ec7a303

So we not able to add top shift with both top dialog and top bar.

mherchel’s picture

Assigned: Unassigned » mherchel

I'm going to fix this.

A bit of background to address the comments above:

What is Drupal.displace() and how does it work.

Drupal.dispace() is a JS function that looks for attributes like data-offset-top, data-offset-left, etc. These are meant to be used by "sticky" position: fixed admin UI elements. And if used properly, will inform the front-end code how to properly place itself on the top of the page. For example, we don't want a fixed header to obscure the admin toolbar (or vice-versa).

So when Drupal.displace() is ran, it'll look for those data-offset properties, return the object, and also update those CSS vars that you're seeing.

(I should really turn this into a blog post).

Anyway, since the navigation's toolbar is fixed to the top, we definitely want that attribute on it.

Why was that line of CSS introduced?

To be honest, I might have done that back in the day (it looks like something that I would have written). When this was written, the top bar did not yet exist. And even though that didn't exist, there are other top bars (e.g. the old workspaces UI). So we needed to accommodate that.

For the Navigation module, the left toolbar is expected to go full height -- even if the the top bar exists. So the fix is simple. We need to just remove the one line of CSS.

mherchel’s picture

Issue tags: -Needs tests

From @catch in #47

I'm not sure what tests would look like for this (that would actually prevent the regression) except for visual regression tests that we don't have a framework for. If someone does, it would be great to add them here. If there's not a good way to add tests, we should open an explicit follow-up to add them later and add it to the navigation stable meta somewhere.

Agree. No easy way to currently add tests, and TBH, I don't even believe this is something that will likely break. I'll add a followup

mherchel’s picture

Issue summary: View changes
mherchel’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update
mherchel’s picture

Issue summary: View changes
mherchel’s picture

Issue summary: View changes

mherchel changed the visibility of the branch 3531516-fix-displace-logic to hidden.

mherchel changed the visibility of the branch 3531516-proper-fix-seriously to hidden.

mherchel changed the visibility of the branch 3531516-proper-fix-seriously to hidden.

mherchel changed the visibility of the branch 11.x to hidden.

mherchel’s picture

Assigned: mherchel » Unassigned
Status: Needs work » Needs review
StatusFileSize
new57.43 KB
new50.47 KB

OK. Easy fix. Hopefully we can get this in for 11.3.


catch’s picture

Status: Needs review » Reviewed & tested by the community

That's pretty clear cut, thanks for the explanation in #52.

godotislate’s picture

Just double-checking: the changes in MR 13918 look to be the same as MR 12461, which was done on a suggestion from #3531516-16: Admin toolbar height is not 100% since upgrading to Drupal 11.2. There's some back and forth on this after #22, and in that subsequent discussion it's unclear to me whether there are issues with this change. Have all those concerns been resolved?

nod_’s picture

Status: Reviewed & tested by the community » Needs work

unfortunately the workspace top bar overlaps with the navigation sidebar, inner menus are fine, we did the same as earlier in this issue 😂

mherchel’s picture

Status: Needs work » Needs review
StatusFileSize
new107.39 KB
new111.91 KB

Added check for when offcanvas is at top of screen.

nod_’s picture

Status: Needs review » Reviewed & tested by the community

Works for me. Conceptually makes sense that everything us pushed by the sidebar

  • lauriii committed b5c2558a on 11.x authored by mherchel
    fix: #3531516 Admin toolbar height is not 100% since upgrading to Drupal...

  • lauriii committed e5d63d3e on 11.3.x authored by mherchel
    fix: #3531516 Admin toolbar height is not 100% since upgrading to Drupal...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Thank you! Tested manually and works great.

I noticed that for some reason the workspaces toggle doesn't always open the panel on the top but links to the page. 🤔 That seemed to be a pre-existing issue so maybe something we should work on in a separate issue?

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

jurgenhaas’s picture

Looks like this creates a regression. The off-canvas fills the whole screen when it's not displayed on top or bottom, but on the right of the screen.

That's because, even when displayed at the right of the screen, the container has the attribute data-offset-top="0"

jurgenhaas’s picture

Not sure if the syntax is correct, but we may have to add &:not:is([data-offset-right]) to the selector. And also, could the off-canvas be displayed on the left? If so, that would probably require another addition to the selector.

rkoller’s picture

StatusFileSize
new132.48 KB

one example to illustrate the regression would be admin/config/user-interface/navigation-block with the navigation module installed - simply configure one block:

the navigation block page configuring one block and the off canvas config spanning across the entire screen

the context menus seem to be broken as well and missing styling but that might be unrelated.