-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Plugins: Ensure sidebar plugins do not get auto-closed when opened on… #17712
Conversation
…d on medium screens
I added a new e2e test which covers the case when you open the plugin sidebar on medium screens. There are 2 unit tests failing which still need to be investigated. See: https://travis-ci.com/WordPress/gutenberg/jobs/241095619#L5659
|
With the fix implemented in the tested hook, expecations for initial state of the hook changes since the effect bails early when the current state of `isSmall` from the viewport store matches the previous state stored on the ref. On initial render, this hook will always bail early. I also added some inline comments to help explain what is happening in the test and what is expected.
I've updated the existing jest unit tests due to new expectations with the changes in this pull. With the fix implemented in the tested hook, expectations for initial state of the hook changes since the effect bails early when the current state of On initial render, this hook will always bail early. I also added some inline comments to help explain what is happening in the test and what is expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a few commits:
- fixing unit tests
- fixing a minor code style issue
- updating the changelog for the
edit-post
package.
Once tests pass this should be good to go.
Thank you for all the help with fixing this regression. Great team work ❤️ Does it mean that I managed to tweak those refs and hooks properly? It’s something which felt a bit like a hack but I couldn’t think of s better way. I only know that refs are popular in this context. |
Looks fine to me 👍 |
#17712) * Plugins: Ensure sidebar plugins do not get auto-closed when opened on small screens * Tests: Add e2e test which ensures that the plugin sidebar gets operned on medium screens * update tests due to new expectations. With the fix implemented in the tested hook, expecations for initial state of the hook changes since the effect bails early when the current state of `isSmall` from the viewport store matches the previous state stored on the ref. On initial render, this hook will always bail early. I also added some inline comments to help explain what is happening in the test and what is expected. * fix code style issue * Add changelog entry for edit-post package
… small screens
Description
Fixes #17623.
I figured out what caused regression here:
gutenberg/packages/edit-post/src/components/editor-initialization/listener-hooks.js
Line 72 in a220eba
This forces the sidebar to get closed on small screens immediately after it gets opened.
Related PR which introduced the regression: #15444