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

Gutenboarding: Domain Picker Modal #41212

Merged
merged 19 commits into from
Apr 17, 2020
Merged

Conversation

yansern
Copy link
Contributor

@yansern yansern commented Apr 17, 2020

Changes proposed in this Pull Request

This PR introduces Domain Picker Modal which is enabled via the gutenboarding/domain-picker-modal feature flag.

There are some architectural decisions being made here so feel free to review & discuss them in this PR.

The component tree looks like this:

DomainPickerButton
   |_DomainPickerPopover
     |_DomainPicker
   |_DomainPickerModal
     |_DomainPicker

Here are the list of changes:

Other changes:

  • onClose event removed from CloseButton component
    onClose is basically the same as onClick. It was removed to prevent typing issues as onClose did not accept undefined values. This component is only used by DomainPicker component so far.

Testing instructions

Note: You need to test this locally. Can't access the modal via the live test page as this is hiding behind a feature flag.

  1. Go to /new and enter your site name.
  2. Click on domain picker button.
  3. Domain picker popover should appear.
    • Due to refactoring, please test all functionalities of domain picker inside a popover, it should behave like before.
    • You should now be able to cycle-tab all the form elements in the domain picker popover, including the close button.
  4. Click on the More Options button
  5. Domain picker modal should appear.
    • Domain picker button should disappear.
    • Resize the browser viewport height until a scrollbar appears.
    • Try scrolling the modal content.
  6. Try opening the domain picker modal on every other gutenboarding pages.

Screenshot

image

Fixes #41081

@yansern yansern requested review from a team as code owners April 17, 2020 07:41
@matticbot
Copy link
Contributor

@matticbot
Copy link
Contributor

matticbot commented Apr 17, 2020

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~5802 bytes added 📈 [gzipped])

name                 parsed_size           gzip_size
entry-gutenboarding     +22782 B  (+1.0%)    +5802 B  (+1.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@dubielzyk
Copy link
Contributor

We're moving to a sticky footer bar for the main buttons on mobile. Can we implement that here?
image

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

We're moving to a sticky footer bar for the main buttons on mobile. Can we implement that here?

@dubielzyk Yes, that's possible. However, that doesn't solve the issue where user cannot exit the modal.

@dubielzyk
Copy link
Contributor

However, that doesn't solve the issue where user cannot exit the modal.

Clicking confirm closes the screen so it should :)

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

Clicking confirm closes the screen so it should :)

Ah okay, I made some decisions based on some assumptions, e.g. onDomainConfirm event. I'm going to revert some changes made! Thanks!

@yansern yansern added [Goal] New Onboarding previously called Gutenboarding [Feature Group] Emails & Domains Features related to email integrations and domain management. labels Apr 17, 2020
@yansern yansern self-assigned this Apr 17, 2020
@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

onDomainConfirm removed. Temporary close button on modal removed.

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

Oops, I didn't foresee that gutenboarding content longer than the domain modal will coz the content behind the show. Need to rethink modal/scrollbar implementation.

It's actually not a bad idea if domain is a page by itself, just need to know which route to go back to?

Or quick and dirty is to css limit the height of page content when modal is rendered.

image

@simison
Copy link
Member

simison commented Apr 17, 2020

This seems relevant; #40885 — i.e. ensuring that something is always selected before hitting "confirm". Can be separate PR.

@simison
Copy link
Member

simison commented Apr 17, 2020

I didn't foresee that gutenboarding content longer than the domain modal will coz the content behind the show. Need to rethink modal/scrollbar implementation.

Another (perhaps simpler?) option could be signal the container to freeze scrollers underneath e.g. by applying wrapper is-modal-open or similar. Can be follow-up PR. :-)

Copy link
Member

@sirreal sirreal left a comment

Choose a reason for hiding this comment

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

A first round of feedback to work on.

/**
* External dependencies
*/
import React, { FunctionComponent } from 'react';
Copy link
Member

Choose a reason for hiding this comment

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

Let's start using this form everywhere:

Suggested change
import React, { FunctionComponent } from 'react';
import * as React from 'react';

Some context: https://twitter.com/sebmarkbage/status/1250284377138802689
This also seems to be the TypeScript convention.

config/development.json Show resolved Hide resolved
return (
<div className="domain-picker-popover">
<Popover
focusOnMount={ isMobile ? 'container' : 'firstElement' }
Copy link
Member

Choose a reason for hiding this comment

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

I seem to get the input focused on mobile now. Is that a regression?

Copy link
Contributor Author

@yansern yansern Apr 17, 2020

Choose a reason for hiding this comment

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

Fixed. useViewportMatch returns false on initial mount, causing the popover to focus on the search input, then after that, it updates itself to true, which at this point, the search input was already in focused. The solution was to keep the DomainPickerPopover component warm, mounted but renders nothing until isOpen flag is set to true. f81559a#diff-3acfaab9099bccb32e73498b4be055a4R41-R46

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Created an issue WordPress/gutenberg#21676.

@@ -2,18 +2,16 @@
* External dependencies
Copy link
Member

Choose a reason for hiding this comment

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

It might be time to organize all these under a domain-picker directory:

domain-picker/
  - index - re-exports whatever makes sense (modal, popover, the contents?)
  - modal
  - popover
  - …

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Created an issue for this. #41221

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

I didn't foresee that gutenboarding content longer than the domain modal will coz the content behind the show. Need to rethink modal/scrollbar implementation.

Another (perhaps simpler?) option could be signal the container to freeze scrollers underneath e.g. by applying wrapper is-modal-open or similar. Can be follow-up PR. :-)

Turns out to be an easy fix. react-modal lib is pretty good! c2154e7

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

Alright, these are fixed and we're ready for 2nd round of review:

  • all review notes from @sirreal
  • search input autofocusing when it shouldn't on mobile view.
  • more options showing in the middle of the popover when popover has a scrollbar.
  • long gutenboarding content visible in the background when modal is open.
  • react-modal showing appElement warning.

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

From this PR, we'll branch out 3 other PRs for:

  • domain connect
  • domain categories filter
  • mobile view for domain picker modal

@yansern yansern added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 17, 2020
Copy link
Member

@alshakero alshakero left a comment

Choose a reason for hiding this comment

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

Love this! I left a few minor comments. And I found one issue regarding persistence that might be a bit complicated to fix, can be in another PR.

When you pick a domain and refresh the page, the domain is persisted alright, but the picker modal doesn't seem to be aware of this information and does a new search based on the site title. I'm not sure how can we go about fixing this.

Comment on lines 4 to 27
.domain-picker-modal-overlay {
// Absolute positioning allows the modal
// to reuse the <body> element's scrollbar.
position: absolute;

// This positions the domain picker modal
// right below the gutenboarding header,
// keeping the header clickable.
top: 64px;
left: 0;

// Using min-height lets the overlay cover
// the entire viewport ensuring nothing behind
// it can be seen.
//
// When the domain picker's content is taller
// than the viewport height, it will expand taller
// than the provided min-height, triggering
// the appearance of the <body> element's scrollbar.
min-height: calc( 100vh - 64px );
width: 100%;

background: var( --studio-white );
}
Copy link
Member

Choose a reason for hiding this comment

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

Beautiful comments. Thanks!

.domain-picker-modal {

.domain-picker__panel-row-main {
padding: 64px 88px;
Copy link
Member

Choose a reason for hiding this comment

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

These numbers seem a bit magical. Can comment on what they are and maybe use variables.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! They are intended to mimic onboarding block's margins and header margins. All ambigous numbers have been replaced with variables or proper mixins. e608b09

return (
<div className="domain-picker-popover">
<Popover
focusOnMount={ isMobile ? 'container' : 'firstElement' }
Copy link
Member

Choose a reason for hiding this comment

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

Created an issue WordPress/gutenberg#21676.

@yansern
Copy link
Contributor Author

yansern commented Apr 17, 2020

When you pick a domain and refresh the page, the domain is persisted alright, but the picker modal doesn't seem to be aware of this information and does a new search based on the site title. I'm not sure how can we go about fixing this.

Created a follow-up issue. #41228

@yansern yansern merged commit 8cdc08e into master Apr 17, 2020
@yansern yansern deleted the add/gutenboarding-domain-picker-modal branch April 17, 2020 14:29
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Apr 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature Group] Emails & Domains Features related to email integrations and domain management. [Goal] New Onboarding previously called Gutenboarding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Gutenboarding: "more domains" modal
6 participants