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

Accessing the scrollTop of scrollContainer (.interface-interface-skeleton__content) is throwing in BlockStyles #36999

Closed
alshakero opened this issue Nov 30, 2021 · 2 comments · Fixed by #37010
Assignees
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@alshakero
Copy link
Contributor

alshakero commented Nov 30, 2021

Description

The BlockStyles component does some calculation to figure the right position of the BlockStylesPreviewPanelFill. It uses the scrollTop of scrollContainer (.interface-interface-skeleton__content), which can be null at times, thus throwing an error.

The bug was likely introduced in #34522. I don't fully understand the changes in #34522, but this tiny change in this line might be sufficient to resolve the issue:

- setContainerScrollTop( scrollContainer.scrollTop + 16 );
+ setContainerScrollTop( scrollContainer?.scrollTop ?? 0 + 16 );

Step-by-step reproduction instructions

See Automattic/wp-calypso#56922 (comment).

Screenshots, screen recording, code snippet

No response

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

cc @ramonjd

@tellisbethel
Copy link

I have a user running into the error: TypeError: Cannot read properties of null (reading 'scrollTop'). This happens when they try adding anything to their sidebar widget on their Tojours theme.

I was going to add their case to the following report, but the highlighted comment led me here:
Automattic/wp-calypso#56922 (comment)

Let me know if more info, like the full error message, is necessary, or if I'm posting in the wrong place! :)

@ramonjd ramonjd self-assigned this Nov 30, 2021
@ramonjd
Copy link
Member

ramonjd commented Nov 30, 2021

Thanks for the report everyone. I'll look into this.

@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Theme Style Variations Related to style variations provided by block themes [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants