Closed sidebar state is not saved as expected

Created on 26 November 2024, about 2 months ago

Problem/Motivation

With πŸ’¬ How to change the default widget the sidebar Active , the sidebar width is now saved. If you collapse the sidebar, reload the page, the sidebar is hidden but the sidebar hide/show toggle state is not set correctly.

Steps to reproduce

  • Go to a mercury editor page
  • Hide the sidebar
  • Reload the page
  • Check the sidebar toggle state is not set and it now behave erratically.

Proposed resolution

Adjust sidebar hide/show JS.

Remaining tasks

TDB

User interface changes

N/A

API changes

N/A

Data model changes

πŸ› Bug report
Status

Active

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @jrockowitz
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    Adding GIF demo

  • πŸ‡ΊπŸ‡ΈUnited States sethhill

    I believe that this behavior was solved in πŸ› Mercury tray resizes when entity browser modal dialogs are opened Active , which is included in the latest 2.1.6 and 2.2.0-beta4 releases. We should now be tracking the current width of the sidebar and responding to that.

    As I was reviewing, I noticed that I'm modifying the innerHTML of the button to toggle between "Hide sidebar" and "Show sidebar," but not doing that to the title attribute. This means that when you roll over the button the tooltip will always read "Hide sidebar." (I also seem to have a habit of somehow clicking right on that tooltip, which intercepts the click.)

    Setting to Needs Work pending that title change. Let us know if you discover other scenarios where the sidebar isn't behaving as expected. Thanks!

  • πŸ‡ΊπŸ‡ΈUnited States sethhill

    I experienced this out in the wild today. I think it's something to do with configuration of sites that don't have the dialog tray width explicitly set. I'll test and find a solution along with the label switch.

  • Merge request !89#3489988: Update sidebar toggle. β†’ (Merged) created by sethhill
  • Merge request !90Resolve #3489988 "Closed sidebar state" β†’ (Merged) created by sethhill
  • Pipeline finished with Skipped
    about 1 month ago
    #367852
    • sethhill β†’ committed a165d030 on 2.1.x
      Issue #3489988 by sethhill, jrockowitz: Closed sidebar state is not...
  • Pipeline finished with Skipped
    about 1 month ago
    #367856
  • Pipeline finished with Skipped
    about 1 month ago
    #367857
    • sethhill β†’ committed 00d11bb1 on 2.2.x
      Issue #3489988 by sethhill, jrockowitz: Closed sidebar state is not...
  • πŸ‡ΊπŸ‡ΈUnited States sethhill
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • πŸ‡ΊπŸ‡ΈUnited States jim_b

    I'm still seeing this issue in both the 2.2.0-rc1 and 2.1.6 versions:

    Once the sidebar is closed, it will not re-open without removing the browser local storage:

    1. mercury-dialog-dock-collapsed
    2. mercury-dialog-dock-width

    Or adding a bit of fail-safe logic to the '/build/js/edit-screen.js' file:

    sidebarToggle.addEventListener('click', (e) => {
    …
    if (sidebarWidth) {
      document.documentElement.style.setProperty('--me-dialog-dock-width', `${sidebarWidth}px`);
    } else {
      document.documentElement.style.setProperty('--me-dialog-dock-width', '400px');
    }
    

    The JS seems to be expecting "sidebarWidth", set from:
    sidebarWidth β†’ mercury-dialog-dock-default-width β†’ drupalSettings.mercuryEditor.width β†’ dialog_tray_width (in the .install file)

Production build 0.71.5 2024