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

Page parent selector with ComboboxControl. #25267

Merged
merged 35 commits into from
Oct 16, 2020
Merged

Conversation

adamsilverstein
Copy link
Member

@adamsilverstein adamsilverstein commented Sep 11, 2020

Description

Use the combox selector to provide a searchable page selector.

Fixes #9441.

Supersedes #16666.

Based on work in #23237.

How has this been tested?

Screenshots

screenshot

Note: screenshot does not include loading indicator which I added a bit later. the logic for loading state needs more work. I found that if I passed false to downshift in initialSelectedItem then later supplied the correct value, the correct value was not shown. I will work on this issue soon.

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • 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.

@adamsilverstein adamsilverstein changed the title Editor still loads if page or template type is not set Page parent selector with downshift Combobox. Sep 11, 2020
@github-actions
Copy link

github-actions bot commented Sep 11, 2020

Size Change: +181 B (0%)

Total Size: 1.19 MB

Filename Size Change
build/annotations/index.js 3.52 kB -1 B
build/autop/index.js 2.72 kB +1 B
build/blob/index.js 667 B -1 B
build/block-directory/index.js 8.57 kB +13 B (0%)
build/block-editor/index.js 130 kB +18 B (0%)
build/block-library/index.js 145 kB -56 B (0%)
build/block-library/style-rtl.css 7.7 kB +31 B (0%)
build/block-library/style.css 7.7 kB +31 B (0%)
build/blocks/index.js 47.6 kB +1 B
build/components/index.js 169 kB -226 B (0%)
build/compose/index.js 9.63 kB +206 B (2%)
build/core-data/index.js 12.1 kB +28 B (0%)
build/data/index.js 8.63 kB +32 B (0%)
build/date/index.js 31.9 kB +3 B (0%)
build/edit-navigation/index.js 10.6 kB +2 B (0%)
build/edit-post/index.js 306 kB -31 B (0%)
build/edit-site/index.js 21.3 kB +18 B (0%)
build/edit-site/style-rtl.css 3.85 kB +44 B (1%)
build/edit-site/style.css 3.85 kB +40 B (1%)
build/edit-widgets/index.js 21.3 kB +57 B (0%)
build/edit-widgets/style-rtl.css 2.97 kB -58 B (1%)
build/edit-widgets/style.css 2.97 kB -59 B (1%)
build/editor/index.js 45.5 kB +88 B (0%)
build/editor/style.css 3.84 kB +1 B
build/format-library/index.js 7.49 kB +1 B
build/html-entities/index.js 622 B +1 B
build/i18n/index.js 3.54 kB -1 B
build/keyboard-shortcuts/index.js 2.39 kB -1 B
build/list-reusable-blocks/index.js 3.02 kB -1 B
build/media-utils/index.js 5.12 kB -1 B
build/notices/index.js 1.69 kB -1 B
build/nux/index.js 3.27 kB +1 B
build/redux-routine/index.js 2.85 kB +1 B
build/server-side-render/index.js 2.6 kB +1 B
build/shortcode/index.js 1.69 kB -2 B (0%)
build/viewport/index.js 1.75 kB +2 B (0%)
build/warning/index.js 1.13 kB -1 B
ℹ️ View Unchanged
Filename Size Change
build/a11y/index.js 1.14 kB 0 B
build/api-fetch/index.js 3.35 kB 0 B
build/block-directory/style-rtl.css 943 B 0 B
build/block-directory/style.css 942 B 0 B
build/block-editor/style-rtl.css 10.9 kB 0 B
build/block-editor/style.css 10.9 kB 0 B
build/block-library/editor-rtl.css 8.65 kB 0 B
build/block-library/editor.css 8.65 kB 0 B
build/block-library/theme-rtl.css 741 B 0 B
build/block-library/theme.css 741 B 0 B
build/block-serialization-default-parser/index.js 1.78 kB 0 B
build/block-serialization-spec-parser/index.js 3.1 kB 0 B
build/components/style-rtl.css 15.5 kB 0 B
build/components/style.css 15.5 kB 0 B
build/data-controls/index.js 685 B 0 B
build/deprecated/index.js 772 B 0 B
build/dom-ready/index.js 568 B 0 B
build/dom/index.js 4.42 kB 0 B
build/edit-navigation/style-rtl.css 868 B 0 B
build/edit-navigation/style.css 871 B 0 B
build/edit-post/style-rtl.css 6.29 kB 0 B
build/edit-post/style.css 6.28 kB 0 B
build/editor/editor-styles-rtl.css 480 B 0 B
build/editor/editor-styles.css 482 B 0 B
build/editor/style-rtl.css 3.85 kB 0 B
build/element/index.js 4.45 kB 0 B
build/escape-html/index.js 734 B 0 B
build/format-library/style-rtl.css 547 B 0 B
build/format-library/style.css 548 B 0 B
build/hooks/index.js 1.74 kB 0 B
build/is-shallow-equal/index.js 710 B 0 B
build/keycodes/index.js 1.85 kB 0 B
build/list-reusable-blocks/style-rtl.css 476 B 0 B
build/list-reusable-blocks/style.css 476 B 0 B
build/nux/style-rtl.css 671 B 0 B
build/nux/style.css 668 B 0 B
build/plugins/index.js 2.44 kB 0 B
build/primitives/index.js 1.34 kB 0 B
build/priority-queue/index.js 790 B 0 B
build/rich-text/index.js 13 kB 0 B
build/token-list/index.js 1.24 kB 0 B
build/url/index.js 4.06 kB 0 B
build/wordcount/index.js 1.17 kB 0 B

compressed-size-action

@adamsilverstein
Copy link
Member Author

@youknowriad - created follow up for loading indicator - #25798

I noticed when we merged the author changes, we now use the ComboboxControl in all cases. We might want to consider using the standard HTML select element when the total number of items is relatively small, eg maybe up to 10, 20 or even 50 items. In these cases it is probably a better user experience (and likely better for accessibility) to show a traditional select. For authors in particular, many sites may only have a few users, so a searchable component is overly complex for their needs.

Shall I open a follow up issue to change this for the authors select, and we can discuss the ideal number to use there?

@afercia
Copy link
Contributor

afercia commented Oct 5, 2020

For authors in particular, many sites may only have a few users, so a searchable component is overly complex for their needs.

I'd be totally in favor of this. No need for a (relatively) complex search UI when a site has only, say, 5 users.

Less likely to happen for pages but yes, there may be sites with no more than 10 pages (or 20, or whatever the agreed limit is).

@youknowriad
Copy link
Contributor

For authors in particular, many sites may only have a few users, so a searchable component is overly complex for their needs.

This would require fetching the number of available pages before rendering which I'm not sure how to do now. It doesn't seem like we have a dedicated data action for that. I'd leave it separate for now.

I made some updates here, I'd love some testing before shipping.

Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

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

Code wise and when tested this feels and looks good 👍 - I have left a couple small comments though. I haven't approved, only for wanting to know about my second comment postTypeSlug related.

packages/editor/src/components/page-attributes/parent.js Outdated Show resolved Hide resolved
packages/editor/src/components/page-attributes/parent.js Outdated Show resolved Hide resolved
@youknowriad
Copy link
Contributor

In aa701ad I discovered an issue unrelated with this PR but made visible where sometimes getEntityRecords don't return the required values. More details here https://wordpress.slack.com/archives/C02RQC26G/p1602586210264400

I'm choosing to deoptimize the _fields filtering a little bit, I don't see any other solution on the frontend side.

@adamsilverstein
Copy link
Member Author

@rianrietveld retying to test the latest version against WordPress trunk, I do not see the pages loading/searching when I type, or the initial page added to the list when my parent is outside the original selection.

I am testing with several hundred pages, several levels deep, ie:

wp post generate --post_type=page --max_depth=4 --count=500

Is it working for you?

@adamsilverstein
Copy link
Member Author

I'd be totally in favor of this. No need for a (relatively) complex search UI when a site has only, say, 5 users.

@afercia - see #26077

@youknowriad
Copy link
Contributor

@adamsilverstein It worked great for me. The command above did create scheduled pages though (not published) so I had to force the date.

Copy link
Contributor

@ntsekouras ntsekouras left a comment

Choose a reason for hiding this comment

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

LGTM 👍 - CI has a failing test (timing problem) that was in other PRs as well. It's not related and can be handled in a separate PR.

@youknowriad youknowriad merged commit 346be7c into master Oct 16, 2020
@youknowriad youknowriad deleted the add/9441-page-selector-b branch October 16, 2020 07:24
@github-actions github-actions bot added this to the Gutenberg 9.2 milestone Oct 16, 2020
@adamsilverstein
Copy link
Member Author

@adamsilverstein It worked great for me. The command above did create scheduled pages though (not published) so I had to force the date.

I'll give it another test.

@SJNBham
Copy link

SJNBham commented Oct 21, 2020

We only see our Homepage as an option in the Parent page combo field now and no search results are returned as of Gutenberg 9.2.0. We have about 1,500 pages on our site. We see the full list of our pages using Gutenberg 9.1.1 (although it takes about 10 seconds for the Parent Page dropdown field to appear when creating a new page. Using Edge (Chromium) and WordPress 5.5.1.

2020-10-21 11_26_43-Add New Page ‹ City of Bellingham — WordPress and 6 more pages - Work - Microsof

2020-10-21 11_26_05-Add New Page ‹ City of Bellingham — WordPress and 6 more pages - Work - Microsof

@adamsilverstein
Copy link
Member Author

@youknowriad I can confirm this does not work for me either in wp core trunk - I see the same results as my previous test:

  • My initial parent page does not load (unless it is in the initial group).
  • No searches are performed, I can only select pages from the initial set.

Note that the user selector still works as expected. I'll try to dig in to see what is happening.

@youknowriad
Copy link
Contributor

Thanks for testing and for your help on this @adamsilverstein
Let's try to fix this during the beta period. Keep on the loop and I'll try to chime in later.

@adamsilverstein
Copy link
Member Author

@youknowriad - followed up with fixes in #26397

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes).
Projects
None yet
Development

Successfully merging this pull request may close these issues.

My Parent Pages Are Still Missing In Gutenberg
7 participants