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

Fix scrolling to the inserted block issue in the iFramed block editor #31448

Merged
merged 7 commits into from
May 14, 2021

Conversation

david-szabo97
Copy link
Member

@david-szabo97 david-szabo97 commented May 4, 2021

Fixes #31251

Description

dom-scroll-into-view library doesn't play nicely with iframes if there is no explicit scrolling container.

Here is a simple CodeSandbox explaining the issue.

This PR patches the package by checking whether the container is an iframe window. In that case it scrolls the scrollingElement instead of the window. We can't scroll the iframe window because it's an iframe so the typical window.scrollTo() doesn't work.

How has this been tested?

Run npm install to patch the dom-scroll-into-view package.

  1. Open site editor
  2. Insert a couple of patterns so you can scroll up and down
    3.1.1. Make sure the insertion point is outside of your viewport, and it's below your current position.
    3.1.2. Insert a pattern, make sure it automatically scrolled down to the inserted pattern
    3.2.1 Make sure the insertion point is outside of your viewport, and it's above your current position.
    3.2.2. Insert a pattern, make sure it automatically scrolled up to the inserted pattern
  3. Do the same for post editor (smoke test)
  4. Play around a little bit in the editor and make sure nothing is broken

Screenshots

Screen.Recording.2021-05-03.at.10.55.11.mov

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • I've tested my changes with keyboard and screen readers.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR (please manually search all *.native.js files for terms that need renaming or removal).

@github-actions
Copy link

github-actions bot commented May 4, 2021

Size Change: +844 B (0%)

Total Size: 1.31 MB

Filename Size Change
build/a11y/index.js 1.11 kB -1 B (0%)
build/annotations/index.js 2.93 kB +1 B (0%)
build/api-fetch/index.js 2.42 kB -1 B (0%)
build/blob/index.js 673 B +1 B (0%)
build/block-directory/index.js 6.59 kB -5 B (0%)
build/block-editor/index.js 116 kB +190 B (0%)
build/block-editor/style-rtl.css 13 kB -28 B (0%)
build/block-editor/style.css 13 kB -26 B (0%)
build/block-library/blocks/navigation/editor-rtl.css 1.32 kB +36 B (+3%)
build/block-library/blocks/navigation/editor.css 1.31 kB +36 B (+3%)
build/block-library/blocks/post-comments-form/style-rtl.css 140 B -110 B (-44%) 🎉
build/block-library/blocks/post-comments-form/style.css 140 B -110 B (-44%) 🎉
build/block-library/editor-rtl.css 9.62 kB +79 B (+1%)
build/block-library/editor.css 9.61 kB +75 B (+1%)
build/block-library/index.js 142 kB +296 B (0%)
build/block-library/style-rtl.css 9.45 kB -49 B (-1%)
build/block-library/style.css 9.46 kB -43 B (0%)
build/block-serialization-default-parser/index.js 1.3 kB -1 B (0%)
build/blocks/index.js 47 kB +59 B (0%)
build/components/index.js 187 kB +830 B (0%)
build/compose/index.js 9.96 kB -2 B (0%)
build/core-data/index.js 12.1 kB -6 B (0%)
build/customize-widgets/index.js 5.79 kB -27 B (0%)
build/customize-widgets/style-rtl.css 698 B +9 B (+1%)
build/customize-widgets/style.css 699 B +9 B (+1%)
build/data-controls/index.js 829 B -1 B (0%)
build/date/index.js 31.8 kB -2 B (0%)
build/dom/index.js 4.62 kB +17 B (0%)
build/edit-navigation/index.js 13.6 kB -77 B (-1%)
build/edit-navigation/style-rtl.css 2.81 kB -46 B (-2%)
build/edit-navigation/style.css 2.81 kB -47 B (-2%)
build/edit-post/index.js 333 kB -63 B (0%)
build/edit-post/style-rtl.css 6.79 kB -187 B (-3%)
build/edit-post/style.css 6.78 kB -183 B (-3%)
build/edit-site/index.js 26.1 kB -64 B (0%)
build/edit-site/style-rtl.css 4.79 kB -113 B (-2%)
build/edit-site/style.css 4.78 kB -113 B (-2%)
build/edit-widgets/index.js 12.6 kB +20 B (0%)
build/edit-widgets/style-rtl.css 3.02 kB +45 B (+2%)
build/edit-widgets/style.css 3.03 kB +45 B (+2%)
build/editor/index.js 60.5 kB +307 B (+1%)
build/editor/style-rtl.css 3.95 kB +49 B (+1%)
build/editor/style.css 3.95 kB +50 B (+1%)
build/element/index.js 3.44 kB +2 B (0%)
build/format-library/index.js 5.68 kB +1 B (0%)
build/i18n/index.js 3.73 kB -2 B (0%)
build/list-reusable-blocks/index.js 2.06 kB -1 B (0%)
build/media-utils/index.js 3.08 kB +1 B (0%)
build/notices/index.js 1.07 kB +2 B (0%)
build/nux/index.js 2.3 kB -2 B (0%)
build/plugins/index.js 2 kB -2 B (0%)
build/primitives/index.js 1.03 kB -1 B (0%)
build/rich-text/index.js 11.9 kB +2 B (0%)
build/server-side-render/index.js 1.64 kB -2 B (0%)
build/shortcode/index.js 1.68 kB -1 B (0%)
build/token-list/index.js 847 B -1 B (0%)
build/viewport/index.js 1.28 kB -1 B (0%)
ℹ️ View Unchanged
Filename Size Change
build/autop/index.js 2.28 kB 0 B
build/block-directory/style-rtl.css 993 B 0 B
build/block-directory/style.css 995 B 0 B
build/block-library/blocks/archives/editor-rtl.css 61 B 0 B
build/block-library/blocks/archives/editor.css 60 B 0 B
build/block-library/blocks/audio/editor-rtl.css 58 B 0 B
build/block-library/blocks/audio/editor.css 58 B 0 B
build/block-library/blocks/audio/style-rtl.css 112 B 0 B
build/block-library/blocks/audio/style.css 112 B 0 B
build/block-library/blocks/block/editor-rtl.css 161 B 0 B
build/block-library/blocks/block/editor.css 161 B 0 B
build/block-library/blocks/button/editor-rtl.css 475 B 0 B
build/block-library/blocks/button/editor.css 474 B 0 B
build/block-library/blocks/button/style-rtl.css 515 B 0 B
build/block-library/blocks/button/style.css 515 B 0 B
build/block-library/blocks/buttons/editor-rtl.css 315 B 0 B
build/block-library/blocks/buttons/editor.css 315 B 0 B
build/block-library/blocks/buttons/style-rtl.css 368 B 0 B
build/block-library/blocks/buttons/style.css 368 B 0 B
build/block-library/blocks/calendar/style-rtl.css 208 B 0 B
build/block-library/blocks/calendar/style.css 208 B 0 B
build/block-library/blocks/categories/editor-rtl.css 84 B 0 B
build/block-library/blocks/categories/editor.css 83 B 0 B
build/block-library/blocks/categories/style-rtl.css 79 B 0 B
build/block-library/blocks/categories/style.css 79 B 0 B
build/block-library/blocks/code/style-rtl.css 90 B 0 B
build/block-library/blocks/code/style.css 90 B 0 B
build/block-library/blocks/columns/editor-rtl.css 190 B 0 B
build/block-library/blocks/columns/editor.css 190 B 0 B
build/block-library/blocks/columns/style-rtl.css 422 B 0 B
build/block-library/blocks/columns/style.css 422 B 0 B
build/block-library/blocks/cover/editor-rtl.css 603 B 0 B
build/block-library/blocks/cover/editor.css 604 B 0 B
build/block-library/blocks/cover/style-rtl.css 1.22 kB 0 B
build/block-library/blocks/cover/style.css 1.22 kB 0 B
build/block-library/blocks/embed/editor-rtl.css 486 B 0 B
build/block-library/blocks/embed/editor.css 486 B 0 B
build/block-library/blocks/embed/style-rtl.css 401 B 0 B
build/block-library/blocks/embed/style.css 400 B 0 B
build/block-library/blocks/file/editor-rtl.css 301 B 0 B
build/block-library/blocks/file/editor.css 300 B 0 B
build/block-library/blocks/file/frontend.js 773 B 0 B
build/block-library/blocks/file/style-rtl.css 255 B 0 B
build/block-library/blocks/file/style.css 255 B 0 B
build/block-library/blocks/freeform/editor-rtl.css 2.45 kB 0 B
build/block-library/blocks/freeform/editor.css 2.45 kB 0 B
build/block-library/blocks/gallery/editor-rtl.css 704 B 0 B
build/block-library/blocks/gallery/editor.css 705 B 0 B
build/block-library/blocks/gallery/style-rtl.css 1.06 kB 0 B
build/block-library/blocks/gallery/style.css 1.05 kB 0 B
build/block-library/blocks/group/editor-rtl.css 160 B 0 B
build/block-library/blocks/group/editor.css 160 B 0 B
build/block-library/blocks/group/style-rtl.css 57 B 0 B
build/block-library/blocks/group/style.css 57 B 0 B
build/block-library/blocks/heading/editor-rtl.css 129 B 0 B
build/block-library/blocks/heading/editor.css 129 B 0 B
build/block-library/blocks/heading/style-rtl.css 76 B 0 B
build/block-library/blocks/heading/style.css 76 B 0 B
build/block-library/blocks/html/editor-rtl.css 281 B 0 B
build/block-library/blocks/html/editor.css 281 B 0 B
build/block-library/blocks/image/editor-rtl.css 717 B 0 B
build/block-library/blocks/image/editor.css 716 B 0 B
build/block-library/blocks/image/style-rtl.css 476 B 0 B
build/block-library/blocks/image/style.css 478 B 0 B
build/block-library/blocks/latest-comments/style-rtl.css 281 B 0 B
build/block-library/blocks/latest-comments/style.css 282 B 0 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B 0 B
build/block-library/blocks/latest-posts/editor.css 137 B 0 B
build/block-library/blocks/latest-posts/style-rtl.css 523 B 0 B
build/block-library/blocks/latest-posts/style.css 522 B 0 B
build/block-library/blocks/legacy-widget/editor-rtl.css 557 B 0 B
build/block-library/blocks/legacy-widget/editor.css 557 B 0 B
build/block-library/blocks/list/style-rtl.css 63 B 0 B
build/block-library/blocks/list/style.css 63 B 0 B
build/block-library/blocks/media-text/editor-rtl.css 176 B 0 B
build/block-library/blocks/media-text/editor.css 176 B 0 B
build/block-library/blocks/media-text/style-rtl.css 492 B 0 B
build/block-library/blocks/media-text/style.css 489 B 0 B
build/block-library/blocks/more/editor-rtl.css 434 B 0 B
build/block-library/blocks/more/editor.css 434 B 0 B
build/block-library/blocks/navigation-link/editor-rtl.css 617 B 0 B
build/block-library/blocks/navigation-link/editor.css 619 B 0 B
build/block-library/blocks/navigation-link/style-rtl.css 94 B 0 B
build/block-library/blocks/navigation-link/style.css 94 B 0 B
build/block-library/blocks/navigation/style-rtl.css 1.27 kB 0 B
build/block-library/blocks/navigation/style.css 1.27 kB 0 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B 0 B
build/block-library/blocks/nextpage/editor.css 395 B 0 B
build/block-library/blocks/page-list/editor-rtl.css 239 B 0 B
build/block-library/blocks/page-list/editor.css 240 B 0 B
build/block-library/blocks/page-list/style-rtl.css 167 B 0 B
build/block-library/blocks/page-list/style.css 167 B 0 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B 0 B
build/block-library/blocks/paragraph/editor.css 157 B 0 B
build/block-library/blocks/paragraph/style-rtl.css 247 B 0 B
build/block-library/blocks/paragraph/style.css 248 B 0 B
build/block-library/blocks/post-author/editor-rtl.css 209 B 0 B
build/block-library/blocks/post-author/editor.css 209 B 0 B
build/block-library/blocks/post-author/style-rtl.css 183 B 0 B
build/block-library/blocks/post-author/style.css 184 B 0 B
build/block-library/blocks/post-content/editor-rtl.css 139 B 0 B
build/block-library/blocks/post-content/editor.css 139 B 0 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B 0 B
build/block-library/blocks/post-excerpt/editor.css 73 B 0 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B 0 B
build/block-library/blocks/post-excerpt/style.css 69 B 0 B
build/block-library/blocks/post-featured-image/editor-rtl.css 338 B 0 B
build/block-library/blocks/post-featured-image/editor.css 338 B 0 B
build/block-library/blocks/post-featured-image/style-rtl.css 100 B 0 B
build/block-library/blocks/post-featured-image/style.css 100 B 0 B
build/block-library/blocks/post-title/style-rtl.css 60 B 0 B
build/block-library/blocks/post-title/style.css 60 B 0 B
build/block-library/blocks/preformatted/style-rtl.css 103 B 0 B
build/block-library/blocks/preformatted/style.css 103 B 0 B
build/block-library/blocks/pullquote/editor-rtl.css 183 B 0 B
build/block-library/blocks/pullquote/editor.css 183 B 0 B
build/block-library/blocks/pullquote/style-rtl.css 318 B 0 B
build/block-library/blocks/pullquote/style.css 318 B 0 B
build/block-library/blocks/query-loop/editor-rtl.css 83 B 0 B
build/block-library/blocks/query-loop/editor.css 82 B 0 B
build/block-library/blocks/query-loop/style-rtl.css 315 B 0 B
build/block-library/blocks/query-loop/style.css 317 B 0 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B 0 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B 0 B
build/block-library/blocks/query-pagination/editor-rtl.css 270 B 0 B
build/block-library/blocks/query-pagination/editor.css 262 B 0 B
build/block-library/blocks/query-pagination/style-rtl.css 168 B 0 B
build/block-library/blocks/query-pagination/style.css 168 B 0 B
build/block-library/blocks/query-title/editor-rtl.css 86 B 0 B
build/block-library/blocks/query-title/editor.css 86 B 0 B
build/block-library/blocks/query/editor-rtl.css 131 B 0 B
build/block-library/blocks/query/editor.css 132 B 0 B
build/block-library/blocks/quote/style-rtl.css 169 B 0 B
build/block-library/blocks/quote/style.css 169 B 0 B
build/block-library/blocks/rss/editor-rtl.css 201 B 0 B
build/block-library/blocks/rss/editor.css 202 B 0 B
build/block-library/blocks/rss/style-rtl.css 290 B 0 B
build/block-library/blocks/rss/style.css 290 B 0 B
build/block-library/blocks/search/editor-rtl.css 189 B 0 B
build/block-library/blocks/search/editor.css 189 B 0 B
build/block-library/blocks/search/style-rtl.css 359 B 0 B
build/block-library/blocks/search/style.css 362 B 0 B
build/block-library/blocks/separator/editor-rtl.css 99 B 0 B
build/block-library/blocks/separator/editor.css 99 B 0 B
build/block-library/blocks/separator/style-rtl.css 251 B 0 B
build/block-library/blocks/separator/style.css 251 B 0 B
build/block-library/blocks/shortcode/editor-rtl.css 512 B 0 B
build/block-library/blocks/shortcode/editor.css 512 B 0 B
build/block-library/blocks/site-logo/editor-rtl.css 440 B 0 B
build/block-library/blocks/site-logo/editor.css 441 B 0 B
build/block-library/blocks/site-logo/style-rtl.css 154 B 0 B
build/block-library/blocks/site-logo/style.css 154 B 0 B
build/block-library/blocks/social-link/editor-rtl.css 164 B 0 B
build/block-library/blocks/social-link/editor.css 165 B 0 B
build/block-library/blocks/social-links/editor-rtl.css 796 B 0 B
build/block-library/blocks/social-links/editor.css 795 B 0 B
build/block-library/blocks/social-links/style-rtl.css 1.32 kB 0 B
build/block-library/blocks/social-links/style.css 1.33 kB 0 B
build/block-library/blocks/spacer/editor-rtl.css 308 B 0 B
build/block-library/blocks/spacer/editor.css 308 B 0 B
build/block-library/blocks/spacer/style-rtl.css 48 B 0 B
build/block-library/blocks/spacer/style.css 48 B 0 B
build/block-library/blocks/table/editor-rtl.css 478 B 0 B
build/block-library/blocks/table/editor.css 478 B 0 B
build/block-library/blocks/table/style-rtl.css 485 B 0 B
build/block-library/blocks/table/style.css 485 B 0 B
build/block-library/blocks/tag-cloud/editor-rtl.css 118 B 0 B
build/block-library/blocks/tag-cloud/editor.css 118 B 0 B
build/block-library/blocks/tag-cloud/style-rtl.css 94 B 0 B
build/block-library/blocks/tag-cloud/style.css 94 B 0 B
build/block-library/blocks/template-part/editor-rtl.css 551 B 0 B
build/block-library/blocks/template-part/editor.css 550 B 0 B
build/block-library/blocks/term-description/editor-rtl.css 90 B 0 B
build/block-library/blocks/term-description/editor.css 90 B 0 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B 0 B
build/block-library/blocks/text-columns/editor.css 95 B 0 B
build/block-library/blocks/text-columns/style-rtl.css 166 B 0 B
build/block-library/blocks/text-columns/style.css 166 B 0 B
build/block-library/blocks/verse/style-rtl.css 87 B 0 B
build/block-library/blocks/verse/style.css 87 B 0 B
build/block-library/blocks/video/editor-rtl.css 569 B 0 B
build/block-library/blocks/video/editor.css 570 B 0 B
build/block-library/blocks/video/style-rtl.css 169 B 0 B
build/block-library/blocks/video/style.css 169 B 0 B
build/block-library/common-rtl.css 1.26 kB 0 B
build/block-library/common.css 1.26 kB 0 B
build/block-library/reset-rtl.css 506 B 0 B
build/block-library/reset.css 507 B 0 B
build/block-library/theme-rtl.css 692 B 0 B
build/block-library/theme.css 693 B 0 B
build/block-serialization-spec-parser/index.js 3.06 kB 0 B
build/components/style-rtl.css 16.2 kB 0 B
build/components/style.css 16.2 kB 0 B
build/data/index.js 7.23 kB 0 B
build/deprecated/index.js 738 B 0 B
build/dom-ready/index.js 576 B 0 B
build/edit-post/classic-rtl.css 454 B 0 B
build/edit-post/classic.css 454 B 0 B
build/escape-html/index.js 739 B 0 B
build/format-library/style-rtl.css 637 B 0 B
build/format-library/style.css 639 B 0 B
build/hooks/index.js 1.76 kB 0 B
build/html-entities/index.js 628 B 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keyboard-shortcuts/index.js 1.65 kB 0 B
build/keycodes/index.js 1.43 kB 0 B
build/list-reusable-blocks/style-rtl.css 629 B 0 B
build/list-reusable-blocks/style.css 628 B 0 B
build/nux/style-rtl.css 718 B 0 B
build/nux/style.css 716 B 0 B
build/priority-queue/index.js 791 B 0 B
build/react-i18n/index.js 924 B 0 B
build/redux-routine/index.js 2.82 kB 0 B
build/reusable-blocks/index.js 2.56 kB 0 B
build/reusable-blocks/style-rtl.css 225 B 0 B
build/reusable-blocks/style.css 225 B 0 B
build/url/index.js 1.95 kB 0 B
build/warning/index.js 1.13 kB 0 B
build/widgets/index.js 1.68 kB 0 B
build/wordcount/index.js 1.24 kB 0 B

compressed-size-action

@david-szabo97 david-szabo97 added the [Status] In Progress Tracking issues with work in progress label May 4, 2021
@david-szabo97 david-szabo97 requested a review from ellatrix as a code owner May 5, 2021 13:32
@david-szabo97 david-szabo97 removed the [Status] In Progress Tracking issues with work in progress label May 5, 2021
@david-szabo97 david-szabo97 requested a review from youknowriad May 5, 2021 13:43
@david-szabo97
Copy link
Member Author

@youknowriad Thanks for the review. After all, I decided to take a different approach. 🙇

@david-szabo97
Copy link
Member Author

I'm not a big fan of patching a package, but scroll-dom-into-view doesn't take iframes into account. The package doesn't seem to be active so I'm not sure if we can get a PR merged there.

@youknowriad
Copy link
Contributor

would love some thoughts from @ellatrix here and whether this affects #31375 too

isFramed &&
scrollingElement.scrollHeight > scrollingElement.clientHeight
) {
scrollContainer = ownerDocument.defaultView;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need all these checks? Why does getScrollContainer( extentNode ) || extentNode.ownerDocument.defaultView not work? I don't think it matters whether it's in a frame or not.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just added a missing return. The goal here is to save all the checks done by scrollIntoView. If we default to getScrollContainer( extentNode ) || extentNode.ownerDocument.defaultView then the scrollContainer will never be falsy, so scrollIntoView will be called every time.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems fine?

@david-szabo97 david-szabo97 force-pushed the fix/edit-site-scroll-to-block branch from 165d38f to 782544a Compare May 5, 2021 14:53
@david-szabo97 david-szabo97 requested a review from ellatrix May 7, 2021 09:17
const scrollContainer = getScrollContainer( extentNode );
const scrollContainer =
getScrollContainer( extentNode ) ||
extentNode.ownerDocument.defaultView;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think this should this be in the getScrollContainer function?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we have the dom-scroll-into-view patched, it should work fine in all the other usages.

But I'd rather not add it to getScrollContainer to let the consumer determine whether they still want to proceed on with the scroll or not. Just like in this case. I'm not familiar with the other usages of getScrollContainer throughout the codebase.

If we plan to move this into getScrollContainer, it would be better to experiment in a separate PR.

Copy link
Contributor

@creativecoder creativecoder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ This fixes the scrolling issue for me when inserting patterns

I'm not a big fan of patching a package, but scroll-dom-into-view doesn't take iframes into account. The package doesn't seem to be active so I'm not sure if we can get a PR merged there.

I think it's worth a try! The package owner is recently active in other packages they own, so there's a chance. But I think this PR can proceed as is, as long as we loop back and remove the patch if the upstream change is accepted.

@david-szabo97 david-szabo97 requested a review from youknowriad May 13, 2021 14:05
@@ -0,0 +1,25 @@
diff --git a/node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js b/node_modules/dom-scroll-into-view/lib/dom-scroll-into-view.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you remove this file?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't. This patch is needed. Without the patch it won't scroll upward, only downward. You can check the CodeSandbox example for a proof.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How des this file works? How it should be included when we move this code into Core? Should we propose a patch upstream instead?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, is this useful for the "template editor" or just the "site editor"?

Copy link
Member Author

@david-szabo97 david-szabo97 May 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is useful for anything that's iframed.

How des this file works? How it should be included when we move this code into Core?

We have a postinstall script that patches the package:

"postinstall": "patch-package && node ./patches/patch-xcode.js",

patch-package applies the patch after npm i.

Should we propose a patch upstream instead?

I will bring this up in the code's repo.

@david-szabo97 david-szabo97 merged commit 5dec957 into trunk May 14, 2021
@david-szabo97 david-szabo97 deleted the fix/edit-site-scroll-to-block branch May 14, 2021 14:05
@ellatrix
Copy link
Member

I'm not sure I agree to patching a package like that. I'll check what else we can do.

@github-actions github-actions bot added this to the Gutenberg 10.7 milestone May 14, 2021
@youknowriad
Copy link
Contributor

Yeah, this is definitely not a great way to fix the issue because it doesn't fix it in the npm package, only in the Gutenberg Plugin. What happens when npm consumers don't use the patch? will it degrade gracefully?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Block library /packages/block-library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inconsistent Pattern Insertion between Page Editor and Site Editor
4 participants