pattern-directory
pattern-directory copied to clipboard
Creator: Block settings toggle button doesn't work
From https://github.com/WordPress/pattern-directory/issues/554#issuecomment-1450907452
Also, I think I've found another issue. The block options (settings) sidebar panel behaves somehow strange: First, it does not open when I am editing a block. I need to enable it in "More tools & options" menu in the upper right corner (the 3 dots). And then, when I close the panel, I can no longer open it. And yet, it has checkmark in the "More tools & options" menu even if it's closed/hidden.
To reproduce:
- Edit or create a pattern
- The "Settings" sidebar toggle in the header should be visible
- Click to open the sidebar, it should open to the Pattern tab unless you had a block selected, in which case it will open to the Block tab.
- The icon is now white on black, active state
- Try closing the sidebar (either with the X or by clicking the icon again)
- The sidebar disappears, but the icon is still white on black, active state
- Click the icon again to open the sidebar
- Nothing happens
Okay, I've spent a while tracing this down, and I think I must be going in circles now.
The ComplementaryAreaToggle
thinks the sidebar is still active after the sidebar is closed. The button is visibly "active" and clicking it does nothing.
The actions are firing correctly, and select( interfaceStore ).getActiveComplementaryArea( 'wporg/pattern-creator' )
returns null, and select( preferencesStore ).get( 'wporg/pattern-creator', 'isComplementaryAreaVisible' )
returns false, which is the correct state for a closed sidebar.
Somehow, this info is not making it to the ComplementaryAreaToggle
, isSelected
is true, so it keeps trying to "disable" rather than enable the sidebar.
I'd guessed that something in the parent components in edit-post
etc forces a re-render which triggers that select to run, so that isSelected
is updated, but trying that myself isn't helping.
I'm going to unassign myself from this issue, since I think it needs a fresh perspective.