Skip to content
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

[WP6.5] Top Toolbar: Toggle does not work as expected when title or block is selected #59263

Closed
t-hamano opened this issue Feb 22, 2024 · 3 comments · Fixed by #59267
Closed
Assignees
Labels
[Package] Edit Post /packages/edit-post [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release

Comments

@t-hamano
Copy link
Contributor

Description

The top block toolbar is expected to open the closed block toolbar when a new block is selected, as mentioned in the comments below.

https://github.com/WordPress/gutenberg/blob/9a8984afb45df1635b2a5048b33e8ab9f95bff27/packages/edit-post/src/components/header/index.js#L93

However, the following two problems occur in the post editor.

  • Selecting a new block does not open the block toolbar
  • Vertical separator appears in the header when clicking title with block toolbar open

This issue does not occur in WP6.4, so I believe it is a regression occurring in WP6.5 or the latest Gutenberg.

Step-by-step reproduction instructions

  • Open the post editor and insert multiple paragraph blocks.
  • Enable "Top tooplbar".
  • Select one paragraph block. The block toolbar should now be open.
  • Close the block toolbar.
  • Select another paragraph block.
  • ❌ The block toolbar should not open.
  • With the block toolbar open, click the post title.
  • ❌ A vertical separator should appear in the header.

Screenshots, screen recording, code snippet

53316e3536999f9ad957311e8b497020.mp4

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@t-hamano t-hamano added [Type] Regression Related to a regression in the latest release [Package] Edit Post /packages/edit-post labels Feb 22, 2024
@Mamaduka
Copy link
Member

Mamaduka commented Feb 22, 2024

Can you reproduce this on the latest Gutenberg trunk?

I can reproduce it. I think there's an bug with sync logic.

@t-hamano
Copy link
Contributor Author

Can you reproduce this on the latest Gutenberg trunk?

Yes. I think that the cause is that the logic is slightly different between the post editor and the site editor, and I'm investigating...

Post Editor:

useEffect( () => {
// If we have a new block selection, show the block tools
if ( hasBlockSelection ) {
setIsBlockToolsCollapsed( false );
}
}, [ hasBlockSelection ] );

Site Editor:

useEffect( () => {
// If we have a new block selection, show the block tools
if ( blockSelectionStart ) {
setIsBlockToolsCollapsed( false );
}
}, [ blockSelectionStart ] );

@Mamaduka
Copy link
Member

I think I've a solution, will push PR shortly.

@Mamaduka Mamaduka self-assigned this Feb 22, 2024
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Edit Post /packages/edit-post [Status] In Progress Tracking issues with work in progress [Type] Regression Related to a regression in the latest release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants