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

Update frame resizing #49910

Merged
merged 35 commits into from
May 19, 2023
Merged

Update frame resizing #49910

merged 35 commits into from
May 19, 2023

Conversation

SaxonF
Copy link
Contributor

@SaxonF SaxonF commented Apr 19, 2023

Updates to the frame:

  • Update design of handle.
  • The frame resizes from its default state down to mobile aspect ratio proportionally from all edges.
  • It's possible to resize beyond the resting state and over the sidebar to engage full screen. If you resize slightly above the sidebar it snaps back into normal browse mode instead.
  • Disables user select while resizing so that the sidebar content and text is not accidentally selected.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Apr 19, 2023
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @SaxonF! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions
Copy link

github-actions bot commented Apr 19, 2023

Size Change: +22.1 kB (+2%)

Total Size: 1.4 MB

Filename Size Change
build/block-editor/index.min.js 198 kB +6 B (0%)
build/block-editor/style-rtl.css 15.1 kB +9 B (0%)
build/block-editor/style.css 15.1 kB +8 B (0%)
build/block-library/blocks/file/editor-rtl.css 316 B +16 B (+5%) 🔍
build/block-library/blocks/file/editor.css 316 B +16 B (+5%) 🔍
build/block-library/blocks/navigation/interactivity.min.js 865 B -7 B (-1%)
build/block-library/editor-rtl.css 12 kB +16 B (0%)
build/block-library/editor.css 12 kB +15 B (0%)
build/block-library/index.min.js 205 kB -17 B (0%)
build/blocks/index.min.js 50.9 kB -14 B (0%)
build/components/index.min.js 232 kB +22.8 kB (+11%) ⚠️
build/edit-post/index.min.js 35.2 kB -28 B (0%)
build/edit-site/index.min.js 64.4 kB -382 B (-1%)
build/edit-site/style-rtl.css 10.5 kB -126 B (-1%)
build/edit-site/style.css 10.5 kB -122 B (-1%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 982 B
build/annotations/index.min.js 2.76 kB
build/api-fetch/index.min.js 2.33 kB
build/autop/index.min.js 2.14 kB
build/blob/index.min.js 472 B
build/block-directory/index.min.js 7.18 kB
build/block-directory/style-rtl.css 1.02 kB
build/block-directory/style.css 1.02 kB
build/block-editor/content-rtl.css 4.12 kB
build/block-editor/content.css 4.12 kB
build/block-editor/default-editor-styles-rtl.css 381 B
build/block-editor/default-editor-styles.css 381 B
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 90 B
build/block-library/blocks/archives/style.css 90 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 126 B
build/block-library/blocks/audio/theme.css 126 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 91 B
build/block-library/blocks/avatar/style.css 91 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 584 B
build/block-library/blocks/button/editor.css 582 B
build/block-library/blocks/button/style-rtl.css 624 B
build/block-library/blocks/button/style.css 623 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/columns/style-rtl.css 409 B
build/block-library/blocks/columns/style.css 409 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 199 B
build/block-library/blocks/comment-template/style.css 198 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.61 kB
build/block-library/blocks/cover/style.css 1.6 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 159 B
build/block-library/blocks/details/style.css 159 B
build/block-library/blocks/embed/editor-rtl.css 293 B
build/block-library/blocks/embed/editor.css 293 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 126 B
build/block-library/blocks/embed/theme.css 126 B
build/block-library/blocks/file/interactivity.min.js 395 B
build/block-library/blocks/file/style-rtl.css 269 B
build/block-library/blocks/file/style.css 270 B
build/block-library/blocks/file/view.min.js 375 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB
build/block-library/blocks/freeform/editor.css 2.44 kB
build/block-library/blocks/gallery/editor-rtl.css 947 B
build/block-library/blocks/gallery/editor.css 952 B
build/block-library/blocks/gallery/style-rtl.css 1.53 kB
build/block-library/blocks/gallery/style.css 1.53 kB
build/block-library/blocks/gallery/theme-rtl.css 108 B
build/block-library/blocks/gallery/theme.css 108 B
build/block-library/blocks/group/editor-rtl.css 654 B
build/block-library/blocks/group/editor.css 654 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 76 B
build/block-library/blocks/heading/style.css 76 B
build/block-library/blocks/html/editor-rtl.css 336 B
build/block-library/blocks/html/editor.css 337 B
build/block-library/blocks/image/editor-rtl.css 834 B
build/block-library/blocks/image/editor.css 833 B
build/block-library/blocks/image/style-rtl.css 652 B
build/block-library/blocks/image/style.css 652 B
build/block-library/blocks/image/theme-rtl.css 126 B
build/block-library/blocks/image/theme.css 126 B
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 507 B
build/block-library/blocks/media-text/style.css 505 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 712 B
build/block-library/blocks/navigation-link/editor.css 711 B
build/block-library/blocks/navigation-link/style-rtl.css 115 B
build/block-library/blocks/navigation-link/style.css 115 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 296 B
build/block-library/blocks/navigation-submenu/editor.css 295 B
build/block-library/blocks/navigation/editor-rtl.css 2.33 kB
build/block-library/blocks/navigation/editor.css 2.33 kB
build/block-library/blocks/navigation/style-rtl.css 2.21 kB
build/block-library/blocks/navigation/style.css 2.2 kB
build/block-library/blocks/navigation/view-modal.min.js 2.81 kB
build/block-library/blocks/navigation/view.min.js 443 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 401 B
build/block-library/blocks/page-list/editor.css 401 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 174 B
build/block-library/blocks/paragraph/editor.css 174 B
build/block-library/blocks/paragraph/style-rtl.css 279 B
build/block-library/blocks/paragraph/style.css 281 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 501 B
build/block-library/blocks/post-comments-form/style.css 501 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 588 B
build/block-library/blocks/post-featured-image/editor.css 586 B
build/block-library/blocks/post-featured-image/style-rtl.css 319 B
build/block-library/blocks/post-featured-image/style.css 319 B
build/block-library/blocks/post-navigation-link/style-rtl.css 153 B
build/block-library/blocks/post-navigation-link/style.css 153 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 281 B
build/block-library/blocks/post-template/style.css 281 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 335 B
build/block-library/blocks/pullquote/style.css 335 B
build/block-library/blocks/pullquote/theme-rtl.css 167 B
build/block-library/blocks/pullquote/theme.css 167 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 450 B
build/block-library/blocks/query/editor.css 449 B
build/block-library/blocks/quote/style-rtl.css 222 B
build/block-library/blocks/quote/style.css 222 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 132 B
build/block-library/blocks/read-more/style.css 132 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 178 B
build/block-library/blocks/search/editor.css 178 B
build/block-library/blocks/search/style-rtl.css 434 B
build/block-library/blocks/search/style.css 432 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 234 B
build/block-library/blocks/separator/style.css 234 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 323 B
build/block-library/blocks/shortcode/editor.css 323 B
build/block-library/blocks/site-logo/editor-rtl.css 754 B
build/block-library/blocks/site-logo/editor.css 754 B
build/block-library/blocks/site-logo/style-rtl.css 203 B
build/block-library/blocks/site-logo/style.css 203 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 674 B
build/block-library/blocks/social-links/editor.css 673 B
build/block-library/blocks/social-links/style-rtl.css 1.4 kB
build/block-library/blocks/social-links/style.css 1.39 kB
build/block-library/blocks/spacer/editor-rtl.css 348 B
build/block-library/blocks/spacer/editor.css 348 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 433 B
build/block-library/blocks/table/editor.css 433 B
build/block-library/blocks/table/style-rtl.css 645 B
build/block-library/blocks/table/style.css 644 B
build/block-library/blocks/table/theme-rtl.css 146 B
build/block-library/blocks/table/theme.css 146 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 174 B
build/block-library/blocks/video/style.css 174 B
build/block-library/blocks/video/theme-rtl.css 126 B
build/block-library/blocks/video/theme.css 126 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.1 kB
build/block-library/common.css 1.1 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/interactivity/runtime.min.js 2.23 kB
build/block-library/interactivity/vendors.min.js 8.15 kB
build/block-library/reset-rtl.css 478 B
build/block-library/reset.css 478 B
build/block-library/style-rtl.css 12.8 kB
build/block-library/style.css 12.8 kB
build/block-library/theme-rtl.css 686 B
build/block-library/theme.css 691 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.83 kB
build/commands/index.min.js 15 kB
build/commands/style-rtl.css 827 B
build/commands/style.css 827 B
build/components/style-rtl.css 11.7 kB
build/components/style.css 11.7 kB
build/compose/index.min.js 12.4 kB
build/core-commands/index.min.js 1.8 kB
build/core-data/index.min.js 16.5 kB
build/customize-widgets/index.min.js 12.2 kB
build/customize-widgets/style-rtl.css 1.38 kB
build/customize-widgets/style.css 1.38 kB
build/data-controls/index.min.js 708 B
build/data/index.min.js 8.68 kB
build/date/index.min.js 40.5 kB
build/deprecated/index.min.js 507 B
build/dom-ready/index.min.js 324 B
build/dom/index.min.js 4.72 kB
build/edit-post/classic-rtl.css 544 B
build/edit-post/classic.css 545 B
build/edit-post/style-rtl.css 7.76 kB
build/edit-post/style.css 7.75 kB
build/edit-widgets/index.min.js 17.3 kB
build/edit-widgets/style-rtl.css 4.53 kB
build/edit-widgets/style.css 4.53 kB
build/editor/index.min.js 45.8 kB
build/editor/style-rtl.css 3.54 kB
build/editor/style.css 3.53 kB
build/element/index.min.js 4.89 kB
build/escape-html/index.min.js 537 B
build/format-library/index.min.js 7.77 kB
build/format-library/style-rtl.css 554 B
build/format-library/style.css 553 B
build/hooks/index.min.js 1.64 kB
build/html-entities/index.min.js 448 B
build/i18n/index.min.js 3.73 kB
build/is-shallow-equal/index.min.js 527 B
build/keyboard-shortcuts/index.min.js 1.78 kB
build/keycodes/index.min.js 1.91 kB
build/list-reusable-blocks/index.min.js 2.14 kB
build/list-reusable-blocks/style-rtl.css 836 B
build/list-reusable-blocks/style.css 836 B
build/media-utils/index.min.js 2.97 kB
build/notices/index.min.js 963 B
build/plugins/index.min.js 1.85 kB
build/preferences-persistence/index.min.js 2.22 kB
build/preferences/index.min.js 1.33 kB
build/primitives/index.min.js 944 B
build/priority-queue/index.min.js 1.52 kB
build/private-apis/index.min.js 939 B
build/react-i18n/index.min.js 696 B
build/react-refresh-entry/index.min.js 8.44 kB
build/react-refresh-runtime/index.min.js 7.31 kB
build/redux-routine/index.min.js 2.74 kB
build/reusable-blocks/index.min.js 2.25 kB
build/reusable-blocks/style-rtl.css 243 B
build/reusable-blocks/style.css 243 B
build/rich-text/index.min.js 11 kB
build/router/index.min.js 1.78 kB
build/server-side-render/index.min.js 2.08 kB
build/shortcode/index.min.js 1.42 kB
build/style-engine/index.min.js 1.52 kB
build/token-list/index.min.js 644 B
build/url/index.min.js 3.65 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 1.08 kB
build/warning/index.min.js 268 B
build/widgets/index.min.js 7.28 kB
build/widgets/style-rtl.css 1.15 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.06 kB

compressed-size-action

@mtias mtias force-pushed the add/edit-site-frame-resizer branch from d0b2752 to d51b541 Compare April 24, 2023 12:48
@github-actions
Copy link

github-actions bot commented Apr 24, 2023

Flaky tests detected in a2bf020.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/5027015473
📝 Reported issues:

@mtias
Copy link
Member

mtias commented Apr 24, 2023

Pushed a couple changes:

  • The frame height is resized proportionally and continuously until it reaches a mobile aspect ratio.
  • It can be resized beyond its initial 100% width to trigger full screen mode.
    • The threshold is if it goes far enough over the sidebar it triggers full screen.
    • If it doesn't go over far enough, it resets.

@mtias mtias added [Feature] Site Editor Related to the overarching Site Editor (formerly "full site editing") [Status] In Progress Tracking issues with work in progress labels Apr 24, 2023
@mtias mtias changed the title Add/edit site frame resizer Update frame resizing Apr 24, 2023
@jasmussen
Copy link
Contributor

jasmussen commented Apr 25, 2023

Took this for a spin. It's mighty impressive from a quick test, here scaling down, up, and into fullscreen:

frame

If you release the frame when it's small though, then grab and size up again — or perhaps if you linger with the resize handle near the vertical edge of the left menu — something appears to go out of sync and becomes disconnected:

sizing up

  • notice in the above GIF how near the full frame snap point, it snaps awkwardly
  • also, how if you keep sizing up there, the frame is not following until a point and then there's a big gap between cursor and frame
  • Not so visible in the GIF, but in this latter state, if you keep holding the cursor while resizing upwards in the menu, the cursor instantly flickers between default and col-resize. As if a calculation is going crazy flipping between a resting state and a resizing state.

Not sure if that helps, it seems those snap calculations are tricky.

Edit: One more thing that's only adjacent to this PR but more noticable: when you move the cursor over the frame, it scales up a little bit. If you then move the cursor to the resize handle and start resizing, it remains in its slightly scaled up state, which is okay, but it feels imprecise somehow.

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

I took a look at this PR — this part of the codebase is basically new to me. If I understand correctly: previously to this PR, the "resizable" part of the UI was the sidebar. With this PR, the canvas becomes the resizable part.

If you release the frame when it's small though, then grab and size up again — or perhaps if you linger with the resize handle near the vertical edge of the left menu — something appears to go out of sync and becomes disconnected:

This is weird. I took a look, and could initially reproduce. Then I made a few tweaks and wasn't able to reproduce the error anymore. I removed my tweaks and I continue not to be able to reproduce the problem. FYI, I was disabling the hover scale-up animation and anything applied when the isOversized internal state is true. @mirka , maybe this is something that you could look into?

Apart from the inline comments, here are a few observations after taking a look at the code and playing around in the browser:

  • The "scale up" animation when hovering the canvas doesn't feel very snappy, and causes some visual glitches: the canvas becomes slightly blurry (probably because of sub-pixel rendering), and it can easily enter a "jittery" mode in which the scrollbar are quickly shown and then hidden in rapid succession.
  • Overall, there's a lot going on, which makes this PR quite hard to debug IMO. I would consider working in isolation, separating the "resizable layout" part from the "animation" part.
  • I would also consider creating a simpler version of this in a codesandbox, in order to be able to focus on this specific task.

Other few comments not necessarily related to this PR, but more in general about this section of Gutenberg:

  • I would reconsider part of the DOM structure. In particular, I would look into simplifying the Hub and the sidebar Header, leaving the top left logo separated from the "Gutenberg" text.
  • I noticed something similar to a caret blinking inside the editor canvas, in the top left corner

packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved

setIsResizing( true );

if ( event.clientX < 344 ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Relying on event.clientX isn't probably the most robust solution here, since the pointer position may not be always accurate (for example, what happens if the pointer leaves the browser window while dragging?).

If we want to know the gap between the canvas and the left edge of the viewport, maybe we could subtract the canvas' width from the viewport's width?

Copy link
Member

Choose a reason for hiding this comment

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

Noting for posterity: clientX does in fact give us usable numbers even when outside the window (e.g. negative numbers for the left edge).

However, this PR now relies solely on the frame width and the ownerDocument width to determine the isOversized boolean. It's just a tiny bit more generic than relying on clientX, but no strong opinion here. I could just as well revert to clientX, since it's simple and this ResizableFrame component is not really generic/reusable anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I like the current version better, we can keep as-is

packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/layout/index.js Outdated Show resolved Hide resolved

return (
<ResizableBox
as={ motion.div }
Copy link
Contributor

Choose a reason for hiding this comment

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

I would try to avoid mixing motion and ResizableBox via polymorphism (as prop).

More in general, given that we're still trying to figure out the best UX for the resizing part, I would almost suggest that for now we remove all animations and focus on ResizableBox.

Once we feel like we nailed the resizing functionality, we can add animation back and fine-tune that too. For example, specifically to this component, I think that all animation-related functionality could be added to the .edit-site-the-frame__content component, instead of using the as prop.

Copy link
Member

Choose a reason for hiding this comment

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

I would try to avoid mixing motion and ResizableBox via polymorphism (as prop).

I realized that, in the current implementation, it is unfortunately necessary that the ResizableBox is also a motion.div 😬 In re-resizable, controlled size prop changes aren't reflected at all until resizeStop, meaning that we cannot do controlled size changes during a resize gesture. Our controlled height changes are actually being executed through the motion.div's height, not re-resizable's size 😓

There is a possibility we could move the height management to re-resizable by giving it dynamic lockAspectRatio values (similar to what we do with resizeRatio). But since it is functional right now, I recommend deferring that to a nice-to-have follow-up.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good, will leave this convo open for posterity

packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

If you release the frame when it's small though, then grab and size up again — or perhaps if you linger with the resize handle near the vertical edge of the left menu — something appears to go out of sync and becomes disconnected:

I also had trouble reproducing this, but I finally got it to happen once. I'll look into this a bit more tomorrow.

packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/layout/style.scss Outdated Show resolved Hide resolved
@SaxonF
Copy link
Contributor Author

SaxonF commented May 4, 2023

@mirka @ciampo I'd recommend also checking out try/frame-resizer branch as it also contains some changes to where the frame sits structurally (above sidebar and content area) which makes it easier to animate imo. It also moves the toolbar into the frame itself as an attempt to reduce moving elements. If there is a way to gracefully work towards that point that would be nice.

@mtias
Copy link
Member

mtias commented May 5, 2023

@mirka it's easy to reproduce — if you resize the frame below 100% the initial width is recomputed, so when we do the flexbox change (above 100%) the width shifts back to the initial conditions. Right now it's being force to be at least 100% mind width, which is why there's a threshold in which the mouse position needs to catch up.

If you try removing the CSS rule of min-width: 100% !important; on .components-resizable-box__container you'll see more clearly what's happening as the width flickers between the desired value and the delta based on the initial condition.

const handleResize = ( event, direction, ref ) => {
const updatedWidth = ref.offsetWidth;
const updatedHeight = ref.offsetHeight;
const handleResize = ( _event, _direction, _ref, delta ) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The split across separate functions makes the logic much more clear:

  • initial useEffect to calculate the "first-render" width and aspect ratio
  • when the resizing starts, get the starting resize width and set isResizing to true
  • the onResize callback only takes care of updating the resizable box size, and setting isOversized
  • when the resizing stops, check if we need to snap back to initial position or to switch to edit mode, and reset all the flags appropriately.

packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
packages/edit-site/src/components/resizable-frame/index.js Outdated Show resolved Hide resolved
@mirka
Copy link
Member

mirka commented May 10, 2023

Behavior-wise, I think we are now at a shippable place, with the resize ratio working as expected and some cursor glitches addressed.

Remaining tasks:

  • After a rebase, there is a new loading spinner (Site Editor: Improve loading experience (v3) #50222) that is clashing with our resizable frame. I'll see what's needed to address this.
  • There seems to be a considerable amount of leftover styles/logic in layout/index.js that should be cleaned up. This could be deferred to a follow-up though.

Copy link
Member

@mirka mirka left a comment

Choose a reason for hiding this comment

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

The spinner issue is addressed 👍

Ready for re-review.

@mirka mirka requested review from mtias and ciampo May 10, 2023 19:21
@SaxonF
Copy link
Contributor Author

SaxonF commented May 18, 2023

Thanks for all the work here. It's looking good. The only issues I've run into have been after resizing the window which seems to throw off calculations. I think this could be a follow up task though as I see this branch as a big improvement over what's live already.

@ciampo
Copy link
Contributor

ciampo commented May 18, 2023

I'm giving this PR a quick look. I'll rebase on top of trunk, solve conflicts, and force push a new version soon.

@ciampo ciampo force-pushed the add/edit-site-frame-resizer branch from 28ba8d7 to 785c6b2 Compare May 18, 2023 13:06
@ciampo ciampo marked this pull request as ready for review May 18, 2023 13:15
Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

This is definitely in a much better state.

I noticed a couple of scenarios that need polishing:

  1. When snapping the resizable frame back to the sidebar or switching to the canvas mode, I can see that the resizable frame doesn't animate smoothly from its current size, but it instead seems to "jump"
frame-resize-glitch.mp4
  1. As @SaxonF also mentioned, the resize logic seems to get a bit out of sync after resizing the browser window
frame-resize-glitch-2.mp4

We can probably merge this PR as is (although it'd be great to get another pair of eyes to confirm that everything looks ok), and follow-up with improvements:

  • around the glitchiness described above
  • clean up the code further and look into avoiding mixing motion and ResizableBox (see this comment)

Borrowed from my initial review:

  • I would reconsider part of the DOM structure. In particular, I would look into simplifying the Hub and the sidebar Header, leaving the top left logo separated from the "Gutenberg" text.
  • I noticed something similar to a caret blinking inside the editor canvas, in the top left corner

@ciampo
Copy link
Contributor

ciampo commented May 18, 2023

Just realized that there's a potentially related e2e failure, that will need more investigating

SaxonF and others added 3 commits May 19, 2023 11:08
It should gradually reduce from original aspect ratio
until reaching a 9 / 19.5 view.
Reset the initial aspect ratio if the frame is resized slightly,
and trigger full screen if the frame is resized far enough over the sidebar.
@ciampo ciampo force-pushed the add/edit-site-frame-resizer branch from 785c6b2 to 44828f7 Compare May 19, 2023 09:09
@ciampo
Copy link
Contributor

ciampo commented May 19, 2023

I'm struggling to debug tests — on my local machine, tests from the test/e2e/specs/site-editor/style-book.spec.js and the test/e2e/specs/site-editor/template-part.spec.js fail consistently also on trunk.

I've rebased again, let's see if e2e tests keep failing.

@WunderBart WunderBart requested a review from kevin940726 as a code owner May 19, 2023 11:12
@WunderBart
Copy link
Member

I'm struggling to debug tests — on my local machine, tests from the test/e2e/specs/site-editor/style-book.spec.js and the test/e2e/specs/site-editor/template-part.spec.js fail consistently also on trunk.

I've rebased again, let's see if e2e tests keep failing.

@ciampo, I've pushed some fixes - a couple of selectors needed to be more specific as they were hitting more than one element to be clicked. There might be one legit failure, though, within the template part spec. I'll double-check when the current job is done.

Copy link
Member

@mtias mtias left a comment

Choose a reason for hiding this comment

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

This is working much better!

I noted down a few refinements to consider, but there are not blockers.

  • It might be something wrong with the larp function, but the heigh of the frame changes slightly after it reaches full height and you keep going over the sidebar. It's very small.
  • We should move the subtle scale effect on hover to the actual frame. Right now on smaller sizes it's weird since hovering on the dark material triggers the zoom.

@mirka
Copy link
Member

mirka commented May 19, 2023

Thanks for the great collab here, everyone!

I addressed the remaining e2e failures. I'll merge now to avoid further conflicts in the layout file 👍

@mirka mirka merged commit c689d9f into trunk May 19, 2023
@mirka mirka deleted the add/edit-site-frame-resizer branch May 19, 2023 19:25
@github-actions github-actions bot added this to the Gutenberg 15.9 milestone May 19, 2023
Comment on lines 27 to 29
// A role selector cannot be used here because it needs to check that the `is-busy` class is not present.
await this.page
.locator( '[aria-label="Editor top bar"] [aria-label="Saved"].is-busy' )
Copy link
Member

@WunderBart WunderBart May 22, 2023

Choose a reason for hiding this comment

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

Nice find. I think it would be good to address this on an implementation level, though (not a scope of this PR). The button should probably say Saving, not Saved as long as the request is pending (.is-busy ATM). cc @kevin940726

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I totally forgot to TODO comment this. Thanks!

Relevant component file

@priethor priethor removed the [Status] In Progress Tracking issues with work in progress label May 22, 2023
@mirka
Copy link
Member

mirka commented May 22, 2023

Jotting down a few more follow-ups I noticed while fixing #50836.

  • Awkward lack of padding when scroll bar is visible.

    Awkward lack of padding when scroll bar is visible in the left sidebar
  • Distracting hover styles when resizing in an index-like view.

    CleanShot.2023-05-22.at.22.36.08.mp4

@youknowriad
Copy link
Contributor

Hello folks, this PR introduce a regression to the "resizing handle" see #51267

Basically, the handle should stay visible and be a focusable element even if we're not actually hovering the iframe.

@youknowriad
Copy link
Contributor

The handle can be hidden if it's not hovered or focused but it should be in the DOM.

canvasWidth = canvasSize.width - canvasPadding;
}
const [ fullResizer ] = useResizeObserver();
const [ isResizing ] = useState( false );
Copy link
Member

Choose a reason for hiding this comment

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

isResizing is always false after this PR. I understand this is a leftover that can be removed. I've prepared a PR to do so at #57119

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") First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants