Problem/Motivation

The way the admin toolbar renders the account link includes a flicker as the vertical position of the icon is changed (see attached screen record in the UI changes section below.).

This might have been introduced in #2899392: user_hook_toolbar() makes all pages uncacheable

Steps to reproduce

  1. Install core (any verison from 8.9.x to 9.3.x).
  2. Login as a user that can see the toolbar.
  3. Load a page.
  4. Watch the 'Account' link (head) icon closely and see it change position.

Proposed resolution

Use CSS and JS to always give toolbar icons min-height: 39px; across all core themes.

Remaining tasks

  1. Decide if we can change stable + stable9 like this, or if we should leave them out of this fix.
  2. Decide if we need a CR.
  3. Reviews / refinements.
  4. RTBC.
  5. Commit.

User interface changes

Removes a flicker of the 'Account' link icon in the toolbar.

Before

After

See https://www.drupal.org/files/issues/2020-08-18/desktopap.gif

API changes

None.

Data model changes

None.

Release notes snippet

TBD, probably not.

CommentFileSizeAuthor
#56 2951268-after-patch.mov390.83 KBnayana_mvr
#56 2951268-before-patch.mov461.01 KBnayana_mvr
#55 patch-does-apply.png81.9 KBbnjmnm
#53 interdiff_52-53.txt648 bytesbnjmnm
#53 2951268-53.patch1.4 KBbnjmnm
#52 2951268-52-custom-placeholder.patch782 bytesbnjmnm
#49 2951268-after-patch.mov453.6 KBnayana_mvr
#49 2951268-before-patch.mov520.77 KBnayana_mvr
#46 2951268-46.patch1.49 KBlauriii
#40 2951268--after--patch--pic.png62.96 KBvikashsoni
#40 2951268--before--patch--pic.png63.13 KBvikashsoni
#38 2951268-38.9x.patch5.03 KBdww
#32 desktopap.gif6.29 MBranjith_kumar_k_u
#30 2951268-30.patch5.1 KBkishor_kolekar
#25 2951268-24_25.interdiff.txt958 bytesdww
#25 2951268-25.patch3.64 KBdww
#24 2951268-19_24.interdiff.txt1.49 KBdww
#24 2951268-24.patch3.64 KBdww
#19 2951268-19-toolbar-rendering.patch3.55 KBdrintios
#17 interdiff-5-17.txt916 bytesndf
#17 2951268-17--icons-toolbar-rendering.patch1.43 KBndf
#15 2951268-15--icons-toolbar-rendering.patch1.38 KBndf
#15 2951268-below-mobile-breakpoint--with-patch-15.gif1.24 MBndf
#12 2951268-above-mobile-breakpoint--with-patch-5.gif416.5 KBndf
#12 2951268-below-mobile-breakpoint--with-patch-5.gif315.91 KBndf
#12 2951268-above-mobile-breakpoint--without-patch.gif268.2 KBndf
#12 2951268-below-mobile-breakpoint--without-patch.gif165.03 KBndf
#5 2951268-5-toolabr-rendering.patch998 byteschi
#3 2951268-3-toolabr-rendering.patch511 byteschi
#3 toolbar-rendering-with-fixed-height.mp4562.11 KBchi
#2 toolbar-rendering.mp4479.22 KBchi

Comments

Chi created an issue. See original summary.

chi’s picture

StatusFileSize
new479.22 KB
chi’s picture

Status: Active » Needs review
StatusFileSize
new562.11 KB
new511 bytes
borisson_’s picture

Status: Needs review » Needs work

I think this should also be fixed in core/modules/toolbar/css/toolbar.icons.theme.css as well as in the theme?

chi’s picture

Status: Needs work » Needs review
StatusFileSize
new998 bytes

I applied the change to the core/modules/toolbar/css/toolbar.icons.theme.css file.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

The video added to this issue makes it clear that this change is helpful. Patch also looks good, great work @Chi

lauriii’s picture

Status: Reviewed & tested by the community » Needs review

Any steps for reproducing this bug? I tried with chrome and I couldn't see any flickering.

chi’s picture

@lauriii have you enabled Big pipe module?

iyyappan.govind’s picture

Hi @Chi

I have enabled the Big pipe module but I couldn't see any flickering. How can I reproduce this issue?Thank you

chi’s picture

So, I've tested it with Drupal 8.6.x, Chrome 63, BigPipe module enabled.

Are you able to reproduce #2952447: Initial page load for a BigPipe-loaded toolbar menu tray results in incorrect toolbar height?

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

ndf’s picture

Was send here by Chi from #2998451: Toolbar tray rendering can result "flickering" resizing of content area to accommodate open trays

4 gifs:
Drupal 8.7.x Standard profile:
1. Mobile: 2951268-below-mobile-breakpoint--without-patch.gif
2. Above mobile breakpoint: 2951268-above-mobile-breakpoint--without-patch.gif
See issue-summary.

Drupal 8.7.x Standard profile + Patch #5
3. Mobile: 2951268-below-mobile-breakpoint--with-patch-5.gif
4. Above mobile breakpoint: 2951268-above-mobile-breakpoint--with-patch-5.gif


Patch #5 works nicely, but only above the mobile breakpoint (only screen and (min-width: 36em))
Needs work because of gif 3.

@lauriii #7 This is just standard profile. I used Giphy capture on OSX+Chrome to record this.

ndf’s picture

Issue summary: View changes
ndf’s picture

Status: Needs review » Needs work
ndf’s picture

Status: Needs work » Needs review
Issue tags: +Needs manual testing
StatusFileSize
new1.24 MB
new1.38 KB

I applied patch #5 and added the same 39px to the mobile .toolbar-icon:before
Result no toolbar-jumping anymore!

Status: Needs review » Needs work

The last submitted patch, 15: 2951268-15--icons-toolbar-rendering.patch, failed testing. View results

ndf’s picture

Status: Needs work » Needs review
StatusFileSize
new1.43 KB
new916 bytes

My patch was wrong because I used drupal-composer-template for development. Let the gitlab integration come soon1

drintios’s picture

Assigned: Unassigned » drintios
drintios’s picture

StatusFileSize
new3.55 KB

Added fix based on @ndf changes this also fixes jumping/flicker toolbar issues https://www.drupal.org/project/drupal/issues/2998451

drintios’s picture

Assigned: drintios » Unassigned
ndf’s picture

Thanks drintios!
Can you provide a interdiff between #19 and 17? That makes reviewing easier.

I have tested your patch and it works nice for the account link (this issue), but it doesn't solve #2998451: Toolbar tray rendering can result "flickering" resizing of content area to accommodate open trays.

Regarding #2998451: Toolbar tray rendering can result "flickering" resizing of content area to accommodate open trays see my comment #12. Your patch solves the horizontal orientation. But when the toolbar is hidden or has vertical orientation there is a redraw.

We seem to be super close to fixing the account link icon here.
Let's don't make it extra hard by adding changes to the toolbar too. (and do that in 2998451).

ndf’s picture

Status: Needs review » Needs work

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dww’s picture

StatusFileSize
new3.64 KB
new1.49 KB

Re-roll of #19 that applies to 8.7.x. Interdiff is confused, so this is from:

diff 2951268-19-toolbar-rendering.patch 2951268-24.patch > 2951268-19_24.interdiff.txt

Otherwise, doesn't address #21 so still NW.

Cheers,
-Derek

dww’s picture

StatusFileSize
new3.64 KB
new958 bytes

If you're also using #2801501-5: Option for the Toolbar *not* to auto-open the "Manage" sub-menu? #24 is wrong. We always want min-height 39 in that case.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

janmejaig’s picture

#25 This patch cannot be applied in the Drupal 9.1.x , so needs reroll.

dww’s picture

kishor_kolekar’s picture

Status: Needs work » Needs review
StatusFileSize
new5.1 KB

Re-rolled against 9.1.x.

tanubansal’s picture

Flickering issue is resolved on 9.1 after adding patch #30

ranjith_kumar_k_u’s picture

StatusFileSize
new6.29 MB

reviewed 2951268-30.patch in drupal 9.1 dev version , Flickering issue is resolved .

ranjith_kumar_k_u’s picture

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

Status: Reviewed & tested by the community » Needs work
Issue tags: -Needs manual testing, -Needs reroll +Needs issue summary update

Thanks everyone for their efforts here and having a working patch. Yay!

Just a few things to do here.

I read the Issue Summary and it explains the problem. It also needs to include the proposed resolution and since this is a UI issue, it needs to have before and after screenshots. It will help reviewers as well if the Issue Summary template is used, there is a button for that if you use dreditor. Setting needs issue summary for that.

Next I looked at the patch, and it is all css/js so I have no comment on that.

Next I looked at the test results, https://www.drupal.org/pift-ci-job/1787674, and see that there are 56 coding standard errors. Setting NW for that.

Next I looked at the tags, this is marked needs manual testing and needs reroll. It looks like that has been done, so removing tags. Please, as you do work on an issue, update the tags. This will save time for anyone, for example, someone who is looking to reroll a patch and finds this issue. Takes time to skim the issue and then finds the reroll is done.

janmejaig’s picture

#30 I have applied this patch and it was working fine for me .

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dww’s picture

Issue summary: View changes
Status: Needs work » Needs review
Issue tags: -Needs issue summary update
StatusFileSize
new5.03 KB
  1. This needed a reroll. Attaching a patch that applies cleanly to both 9.2.x and 9.3.x (for now).
  2. Also added the same CSS changes to stable9. Not sure we should change stable* at all, but if so, we should do both.
  3. Updated the summary with the template. Removing that tag.
  4. Re: "56 coding standard errors": I believe that core CSS files don't comply with our current linting standards. Any patch that touches the CSS ends up triggering a "these files changed" check and all existing errors in each modified file are reported as CS violations. They're pre-existing, not introduced by this patch. At least that's how I understand the current situation.
  5. Remaining tasks include:
    • Decide if we can change stable + stable9 like this, or if we should leave them out of this fix.
    • Decide if we need a CR.

    RFC

Thanks!
-Derek

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

vikashsoni’s picture

StatusFileSize
new63.13 KB
new62.96 KB

Applied #38 patch applied successfully
After patch in profile icon in toolbar min-height added
Thanks for the patch
For ref sharing screenshot...

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

gaurav-mathur’s picture

Assigned: Unassigned » gaurav-mathur
gaurav-mathur’s picture

Assigned: gaurav-mathur » Unassigned

Last patch doesn't apply to target branch 10.1.x-dev, please reroll the patch.
Thank you.

bnjmnm’s picture

I failed to find this issue before creating the very similar #3331531: Reduce toolbar reflow/repaint due to username lazy builder. My approach is different, but should be easier to review as it's just removing a few lines. Plus, it addresses inefficiencies with vertical and horizontal rendering, while the current solution here only addresses vertical - maybe @dww or someone else on this issue can weigh in on their preferred approach and we can close one of the issues and transfer credit.

lauriii’s picture

StatusFileSize
new1.49 KB

Here's a new approach that doesn't require specifying heights.

Status: Needs review » Needs work

The last submitted patch, 46: 2951268-46.patch, failed testing. View results

lauriii’s picture

Status: Needs work » Needs review

Not sure where did #47 come from but looks like #46 passed 🤔

nayana_mvr’s picture

StatusFileSize
new520.77 KB
new453.6 KB

Verified the patch #47 and tested it on Drupal version 10.1.x. Now the vertical position of the account icon is not changing on page load and I have added the before and after screen recordings for reference.

tim.plunkett’s picture

Issue tags: +Field UX
lauriii’s picture

Status: Needs review » Needs work

#2632750: Interface previews/skeleton screens through optional "preview" or "placeholder" templates landed which means we could probably customize the placeholder for the account link.

bnjmnm’s picture

Status: Needs work » Needs review
StatusFileSize
new782 bytes

Patch has the placeholder approach, and here's a video of it working on a throttled connections, so we can see that the icon remains in the correct location throughout the deliberately slow load process. https://youtu.be/JrU7Cvqr53c

bnjmnm’s picture

StatusFileSize
new1.4 KB
new648 bytes
nayana_mvr’s picture

Not able to verify the patch #53 as it is showing error while applying the patch:

Checking patch core/lib/Drupal/Core/Render/Renderer.php...
error: while searching for:
        '#cache',
        '#create_placeholder',
        '#lazy_builder_preview',
        // The keys below are not actually supported, but these are added
        // automatically by the Renderer. Adding them as though they are
        // supported allows us to avoid throwing an exception 100% of the time.

error: patch failed: core/lib/Drupal/Core/Render/Renderer.php:327
error: core/lib/Drupal/Core/Render/Renderer.php: patch does not apply
Checking patch core/modules/user/user.module...
bnjmnm’s picture

StatusFileSize
new81.9 KB

@Nayana Ramakrishnan just above your comment in #54 is clear evidence the patch applies fine. Whenever a patch is uploaded, Drupal's testbot applies that patch to the specified branch and runs tests. If there's a green box stating "pass", that means the patch is applying to Drupal fine.

Since it's proven that the patch is applying fine to Drupal 10.1.x, the issue is specific to you and doesn't need a comment here. If you need help with troubleshooting the patch not applying, Drupal Slack might be a good place to look as what you're dealing with is not specific to this issue. Ideally we avoid comments within an issue that are not specific to that issue (such as the one I just typed... 😐)

nayana_mvr’s picture

StatusFileSize
new461.01 KB
new390.83 KB

@bnjmnm Thank you for pointing out that. I guess there was some issue with my repo. I created a new repo and applied the patch. Patch #53 applied cleanly and tested it on Drupal version 10.1.x. Attaching the before and after screen recordings for reference.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed this.

+++ b/core/lib/Drupal/Core/Render/Renderer.php
@@ -327,6 +327,7 @@ protected function doRender(&$elements, $is_root_call = FALSE) {
+        '#preview',

This change was surprising to me at first, but after re-reading #2632750: Interface previews/skeleton screens through optional "preview" or "placeholder" templates, it was a missed addition from that issue.

Due to the nature of this change (printing a space during rendering), and given the gaps in our testing infrastructure, this is not testable (other than manually).

Manual review shows that the vertical position is fixed!

  • lauriii committed 905efbc9 on 10.1.x
    Issue #2951268 by dww, ndf, Chi, bnjmnm, lauriii, drintios,...
lauriii’s picture

Status: Reviewed & tested by the community » Fixed

Committed 905efbc and pushed to 10.1.x. Thanks!

wim leers’s picture

Linked this as an example in the interface preview change record: https://www.drupal.org/node/3338948

Status: Fixed » Closed (fixed)

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