Problem/Motivation

While reviewing #2949991: Add workspace UI in top dialog I found a bug with the toolbar and the off-canvas dialog.

The current patch updates the off_canvas_top to be able to demonstrate the problem without the workspaces module involved.

  1. Login with a user who has access to the toolbar
  2. Goto /off-canvas-test-links
  3. Click Open top panel 1
  4. When the top dialog opens notice the toolbar is at the bottom of the top dialog
  5. Click "Open modal!" on the main page
  6. Notice that now the toolbar is at the top of the top dialog.
  7. Close the dialog
  8. Notice that now the toolbar remains at the top of the top dialog.

This behavior happens whether the dialog link is the off-canvas dialog or on the main page.

Proposed resolution

Fix the margin-top of <nav id="toolbar-bar" role="navigation" aria-label="Toolbar items" class="toolbar-bar clearfix" data-offset-top="" style="margin-top: 0px;"> on dialog open/close.

Remaining tasks

User interface changes

Before

API changes

Data model changes

Issue fork drupal-2985324

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

tedbow created an issue. See original summary.

tedbow’s picture

StatusFileSize
new6.01 KB

Settings to needs work because there are no tests in the patch yet.

timmillwood’s picture

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.

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.

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.

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.

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.

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.

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

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

tinto’s picture

suresh prabhu parkala’s picture

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

Re-rolled the patch. Please review.

smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs issue summary update

Issue summary needs to be updated with proposed solution (if still an issue)

Also #2 still cleanly applied to 11.x.

amateescu’s picture

gauravvvv’s picture

StatusFileSize
new335.15 KB

This is still happening after the patch #2, as well. please see screenshot for reference

gauravvvv’s picture

Issue summary: View changes
Issue tags: -Needs issue summary update

gauravvvv’s picture

Earlier, `settings.drupalOffCanvasPosition` was undefined on the second dialog open. I have updated it. However, it is still calculating the height of the off-canvas incorrectly, which needs to be fixed. I am leaving this to NW.

gauravvvv’s picture

Status: Needs work » Needs review
StatusFileSize
new2.75 MB

I have added after merge request screenrecording for reference, please review

kanchan bhogade’s picture

Status: Needs review » Needs work
StatusFileSize
new524.31 KB
new263.33 KB

I've tested MR 8330 On Drupal 11.x
MR is applied cleanly

The toolbar position issue is resolved; however, if the off-canvas is closed using the cross icon, the toolbar position remains unchanged and the page scrolls to the top.
Adding Screen recording for reference

Also as per issue Summary MR is "Open failed pipeline"

Moving to "Needs work"

Utkarsh_33 made their first commit to this issue’s fork.

utkarsh_33’s picture

this commit fixes the problem mentioned in #23.

utkarsh_33’s picture

Status: Needs work » Needs review
kanchan bhogade’s picture

StatusFileSize
new870.62 KB

I've tested Updated MR 8330 On Drupal 11.x
MR is applied cleanly

"The off-canvas is closed using the cross icon, the toolbar position remains unchanged and the page scrolls to the top" issue resolved.
Adding Screen recording for reference

RTBC+1

smustgrave’s picture

Not sure this one that can get tests or is large enough for them so will remove that tag, any disagrees please add back.

Will tag for an after screenshot to be added though

gauravvvv’s picture

With open dialog

Closed dialog

smustgrave’s picture

screenshots should be part of the summary.

bnjmnm’s picture

Status: Needs review » Needs work

The current MR seems like quite a bit of height-calculating logic with several new mutable variables in play. I wonder if this can be done simpler.

The toolbar moves because of the margin reset in toolbar.js

if (toolbarBar) {
            toolbarBar.style.marginTop = '0';

// etc...

Perhaps a solution that doesn't apply the reset when a top off-canvas exists would take care of it?

if (toolbarBar) {
           if (<NO TOP OFF-CANVAS>) {
              toolbarBar.style.marginTop = '0';

}
// etc...

This would also be reasonably easy to add as a test inside \Drupal\Tests\system\FunctionalJavascript\OffCanvasTest, and the toolbar doesn't even have to be present - just an element with the id toolbar-bar that you can check the margin-top of.

utkarsh_33’s picture

The if condition that i added is just opposite of what's mentioned in #31 but still it work.I will try to deep dive more into that.

utkarsh_33’s picture

Status: Needs work » Needs review
smustgrave’s picture

@bnjmnm wonder your thoughts on the current MR?

smustgrave’s picture

Could an after screenshot be added?

bnjmnm’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

This isn't quite what I suggested in #31. Left a comment in the MR

Also will need tests - #31 also has an approach to how.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.