Closed (outdated)
Project:
Drupal core
Version:
11.x-dev
Component:
node system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
29 Nov 2014 at 12:07 UTC
Updated:
4 Jul 2025 at 03:22 UTC
Jump to comment: Most recent, Most recent file


Comments
Comment #1
wim leersWe probably want the preview bar to push everything down? Perhaps we even want it to sit above the toolbar? Not sure.
Comment #2
joelpittetYes pushing it down would probably be ideal. A bit tricky with position fixed items in the theme (aka sticky headers) although that would be a problem regardless.
Not sure what pattern is being used for the navbar but maybe they can work the same and together?
Comment #3
lewisnymanWe should be able to hook into #1847084: Measure/track displacing elements better + provide change events for them (fix overlay + toolbar)
Comment #4
berdirThis is node specific.
Comment #5
berdirDouble post.
Comment #6
wim leers#2 Yes, for those kind of changes we have
Drupal.displace(indisplace.js).Comment #7
manjit.singhComment #8
lewisnymanI'm wondering if we should even fix this, if a user clicks on those links they loose their changes to the node. Is this a use case we want to support?
Comment #9
lauriiiI think its very annoying especially on a smaller screen if the admin menu doesn't push the content down. It might not be that big problem with bartik but with your custom theme it might be PITA.
Comment #10
lewisnymanThis is just the node preview bar though?
Comment #11
idebr commentedThere is no patch attached to this issue to work on, so I believe this should be on 'Active'.
Comment #12
henrijs.seso commentedMarked #2550691: Node preview bar occludes page header, should use Drupal.displace() JS API instead of CSS as duplicate to this, but it has some ideas on Proposed resolution - use Drupal.displace(), which was designed for this.
Comment #13
bruvers commentedComment #14
kylebrowning commentedI attempted to fix this issue, but I believe I'm missing something.
Patch attached does displace the bar, but for some reason its not displacing the page. Using Drupal.displace wrong?

Comment #15
bruvers commentedI will look into this issue today. The problem seems to be that
Drupal.displacedoes not deal correctly with multiple elements that havedata-offset-topset.Comment #16
bruvers commentedSetting
data-offset-topon.node-preview-containerdoes not solve this issue as you can see in the screenshot from comment #14.The problem is that
Drupal.displaceassumes that every displacing element is positioned correctly while.node-preview-containerhas neithertopormargin-topset. The toolbar module does it's own calculations and setsmargin-topinToolbarVisualView.jsline 255.Possible solution. The Node Preview toolbar could do it's calculations, check the orientation of the toolbar, get the height of the toolbar but this does not seem to be generic enough aproach. What if the user installs another toolbar module?
Another solution would be not to use
Drupal.displaceand instead setpadding-topon the body element to whatever the value is now + the height of.node-preview-container.Comment #17
lewisnymanYeah, it feels like part of the problem is that the node preview container is injected into the page as a separate component to the toolbar and then styling to look like it's part of the toolbar UI.
I think this would automatically work if we moved this
node-preview-containerto the toolbar module, rename it to something generic liketoolbar-information-containerand then allow the node module to inject into it somewhow. How does that sound?Comment #18
bruvers commentedNot sure about the best solution. Giving a chance to others to take over this task.
Comment #19
kylebrowning commentedIf we added it to toolbar, and someone turned toolbar off, then what?
Comment #20
lewisnyman@kylebrowning Good point... what happens when you disable the toolbar now?
I tried with the patch applied and it still doesn't fix the issue:

Displace.js doesn't seem to be running. Is there something else we need to pass into Drupal.settings?
Comment #21
lewisnymanComment #22
snap_xI suggest to add class to body on preview page and to add padding-top that depends on that class. It doesn't depend on Toolbar module.
Comment #23
andypostand what's about "displace"?
Comment #26
bruvers commented@andypost As mentioned in #16
Drupal.displaceshould work fine if the preview bar would be positioned using CSStopandmargin-topvalues the same as the toolbar does. The preview bar currently has notopnormargin-topvalues set, this makesDrupal.displacepush it down every time it runs.This issue https://www.drupal.org/node/1847084 led to the creation of
Drupal.displace. If you want to get an idea how the code works see bottom part of comment #69.The problem is how do we get a correct
topandmargin-topvalues taking into account that the toolbar changes it's layout, that the toolbar might be disabled or there might be other elements that are displacing content. It seemsDrupal.displacecould be extended to provide some sort of global registry for displacing elements. A similar idea was proposed in the same aforementioned discussion in #66.Comment #27
nod_When the layout changes because of the toolbar or something else having to do with displace we have an event firing, use that: http://read.theodoreb.net/drupal-jsapi/global.html#event:drupalViewportO...
Drupal.displace already does too much (it shouldn't have to figure out element size automatically) so I'm not willing to expand on that, especially now.
Comment #28
bruvers commentedOk, we cannot expand
Drupal.displaceto register all displacing elements. This means that every fixed element must determine it's own correct position. The preview bar therefore must know what elements are already position: fixed, determine their height, set it's owntopandmargin-topvalue and update those when layout changes. This sounds tricky.A better way to go about this could be to have all displacing elements in one container. That container would be positioned with
position: fixed; top: 0;. Then it's children would not have to be positioned fixed and no JS height calculations would have to be made.Lewis already mentioned a similar idea in #17.
Comment #29
bruvers commentedOf course, we can't expect every module to place it's displacing elements markup into one template. Modules could mark elements as displacing the same way it is done now with the
data-offset-topattribute and instead of passing an offset value in pixels they would pass a weight value for ordering. This could look something like this:data-offset-top="-20". Than a script would pick up all displacing elements, sort them by weight and place them into the one single fixed positioned container.Drupal.displacewas built to be a convenient tool for a single displacing element that can be aligned to any edge of the viewport. The real world use case is rather that we have multiple items.Drupal.displaceis good at what it does but it just doesn't solve the problems we have with multiple items.These changes would introduce a new feature and most likely will not cut it into 8.0. Possible solutions or rather workarounds for 8.0 could be:
Comment #32
wim leersComment #33
xjm@alexpott, @catch, @cilefen, @effulgentsia, and I discussed this issue this morning while triaging issues with the entity and field system maintainers. We agreed that this does not meet the criteria for a major bug. While there is definitely a visual bug, as @bruvers points out, the impact is not that serious for most sites and content creators.
Thanks for working on this issue!
Comment #34
droplet commented1. the Preview bar is position: fixed;
2. the padding-top is tracking & applying via Toolbar.
3. Preview bar needs to detect the Toolbar status. If Toolbar is found, it should delay the BODY "padding-top' re-calculation after Toolbar.
There's an OutsideIn module, I think we should keep the visuals consistency of these top bars.
Comment #41
komalk commentedRerolled patch failed to apply on 8.9.x
Comment #43
jproctorRerolled patch for 9.3.x and added a
removeClass()so we don’t leave cruft on detach.Comment #47
acbramley commentedI'm not sure if this is still needed. Tested in both Umami and Olivero and it looks good to me
Comment #48
acbramley commentedClosing out for now as it's been 3 months since #47 and can no longer be reproduced, it seems likely this was an issue with Bartik.
Adding credit for all the good work that was done here.
Comment #53
xjmSaving triage credits from #33 and for @acbramley, and for various issue reviewers and contributors who worked on the Bartik bug.
Comment #54
xjmI guess "outdated" is better, since it was reproducible previously.