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.
- Login with a user who has access to the toolbar
- Goto /off-canvas-test-links
- Click Open top panel 1
- When the top dialog opens notice the toolbar is at the bottom of the top dialog
- Click "Open modal!" on the main page
- Notice that now the toolbar is at the top of the top dialog.
- Close the dialog
- 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
| Comment | File | Size | Author |
|---|---|---|---|
| #29 | Screenshot 2024-06-20 at 9.24.06 AM.png | 304.61 KB | gauravvvv |
| #29 | Screenshot 2024-06-20 at 9.23.54 AM.png | 316.29 KB | gauravvvv |
| #27 | Welcome! _ Drupal 11.mp4 | 870.62 KB | kanchan bhogade |
| #23 | BeforeMR.mp4 | 263.33 KB | kanchan bhogade |
| #23 | AfterMR.mp4 | 524.31 KB | kanchan bhogade |
Issue fork drupal-2985324
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
Comment #2
tedbowSettings to needs work because there are no tests in the patch yet.
Comment #3
timmillwoodI noticed this issue, which lead me to open #2983120: OffCanvas dialog doesn't close when opening a standard Dialog.
Comment #14
tintoComment #15
suresh prabhu parkala commentedRe-rolled the patch. Please review.
Comment #16
smustgrave commentedIssue summary needs to be updated with proposed solution (if still an issue)
Also #2 still cleanly applied to 11.x.
Comment #17
amateescu commentedIt's definitely still an issue, I just closed #3152830: After closing workspaces dialog the vertical admin toolbar is displayed on top of workspaces interface as a duplicate of this one.
Comment #18
gauravvvv commentedThis is still happening after the patch #2, as well. please see screenshot for reference

Comment #19
gauravvvv commentedComment #21
gauravvvv commentedEarlier, `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.
Comment #22
gauravvvv commentedI have added after merge request screenrecording for reference, please review
Comment #23
kanchan bhogade commentedI'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"
Comment #25
utkarsh_33 commentedthis commit fixes the problem mentioned in #23.
Comment #26
utkarsh_33 commentedComment #27
kanchan bhogade commentedI'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
Comment #28
smustgrave commentedNot 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
Comment #29
gauravvvv commentedWith open dialog

Closed dialog

Comment #30
smustgrave commentedscreenshots should be part of the summary.
Comment #31
bnjmnmThe 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
// etc...
Perhaps a solution that doesn't apply the reset when a top off-canvas exists would take care of it?
}
// 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 idtoolbar-barthat you can check the margin-top of.Comment #32
utkarsh_33 commentedThe 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.
Comment #33
utkarsh_33 commentedComment #34
smustgrave commented@bnjmnm wonder your thoughts on the current MR?
Comment #35
smustgrave commentedCould an after screenshot be added?
Comment #36
bnjmnmThis 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.