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

Site editor: Block settings dropdown remains in place when scrolling #42725

Closed
talldan opened this issue Jul 27, 2022 · 1 comment · Fixed by #43617
Closed

Site editor: Block settings dropdown remains in place when scrolling #42725

talldan opened this issue Jul 27, 2022 · 1 comment · Fixed by #43617
Assignees
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Package] Components /packages/components [Type] Regression Related to a regression in the latest release

Comments

@talldan
Copy link
Contributor

talldan commented Jul 27, 2022

Step-by-step reproduction instructions

  1. Ensure you're editing a template with enough content that a scrollbar displays
  2. Select a block and open the block settings dropdown
  3. Scroll the content

Expected: the block settings dropdown scrolls with the content (matching the toolbar's position)
Actual: the block settings dropdown remains in place while scrolling

Screenshots, screen recording, code snippet

Kapture.2022-07-19.at.16.19.57.mp4

Environment info

Latest trunk

Reproduced using Mac OS / Brave

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

@talldan talldan added [Type] Regression Related to a regression in the latest release [Package] Components /packages/components [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") labels Jul 27, 2022
@talldan
Copy link
Contributor Author

talldan commented Jul 27, 2022

I know why this happens, so I'll leave some details.

The block toolbar uses this logic to update its position when scrolling:

useLayoutEffect( () => {
if ( ownerDocument === document ) {
return;
}
ownerDocument.addEventListener( 'scroll', update );
return () => ownerDocument.removeEventListener( 'scroll', update );
}, [ ownerDocument ] );

The toolbar references the block for its position. ownerDocument in the code above is the document of the iframe that the block is inside. The popover listens for a scroll event on the iframe's document, and updates its own position as the iframe is scrolled.

For the block settings dropdown, this doesn't work. It references the button in the block toolbar for its position, and the block toolbar isn't within the iframe. The block toolbar's parent document is the page document, it isn't scrollable so no event is triggered, and the dropdown remains static.

@talldan talldan changed the title Site editor: Block toolbar dropdowns remain in place when scrolling Site editor: Block settings dropdown remain in place when scrolling Jul 27, 2022
@talldan talldan changed the title Site editor: Block settings dropdown remain in place when scrolling Site editor: Block settings dropdown remains in place when scrolling Jul 27, 2022
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Aug 24, 2022
@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Package] Components /packages/components [Type] Regression Related to a regression in the latest release
Projects
None yet
2 participants