-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Start User: Add Continue as user to the sign in flow #58221
Conversation
Link to Calypso live: https://calypso.live?image=registry.a8c.com/calypso/app:build-20992 |
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~1630 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. Sections (~999 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~1767 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. 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. Generated by performance advisor bot at iscalypsofastyet.com. |
Hey @enejb in the video 0:27, just want to double-check here:
If I spot anything, will let you know. Thank you! 😺 |
Yes I am hoping to remove the screen that shows up on 0:27. I still need to play around a bit to try to figure that part out. @tyxla do you have any suggestions on how to fix that?
I think we can probably fix that across all the screens on mobile. Would that make sense to you? @annchichi
Good catch! |
client/signup/steps/user/index.jsx
Outdated
@@ -447,6 +451,17 @@ export class UserStep extends Component { | |||
isSocialSignupEnabled = true; | |||
} | |||
|
|||
if ( this.props.step && 'completed' === this.props.step.status ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rendering doesn't seem like the right time to perform such a side effect. At the time the redirect happens, the redirect will have finished, which is likely why you're seeing the form shortly before the redirect.
Have you tried moving the redirection logic to componentDidUpdate()
? Furthermore, it might need to be moved above to the controller level, since it happening in the step component could already be "too late".
Instead of showing a notice this lets is not very helpful Let's show the user a Continue as User component.
3d7c8e4
to
e3bfec8
Compare
This is done so that we don't accidentally send the user to the continue page when they are creating a new user account
On second try in Firefox the back button didn't work any more. this fixes it by making sure that we don't remove the sign in step if there the page as loaded via history.
@tyxla I managed to get things working in FF now. 🥳 Screen.Recording.2021-11-25.at.6.14.04.AM.-.works.in.FF.mp4Can you take a look again? I also came across an error in the
That I think we should address in a different PR. |
Woohoo! 0:44 is working now. Thanks @enejb 🥳 Regarding the copy "Log in with another account", it was not clear if users can also sign out based on design feedback. So I think we can be even more clearer like this "Sign out or log in with another account" What do you think? 😄 Thanks for this! |
It is definitely something we can update. I think a more refined wording makes sense here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This appears to be testing well!
I've left some feedback, and not sure if I can add much more from a framework perspective.
Could we perhaps ask someone more familiar with signup and onboarding, like @Automattic/ganon to provide a more thorough review?
color: var( --color-text-subtle ); | ||
font-size: $font-body-small; | ||
text-align: center; | ||
height: calc( 70vh - 80px ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems a bit made-up, can we add a comment as to where it came from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I am not really sure exactly why those numbers have been chosen but they make things look okay across different screen sizes that I have tested.
// Remove the user step unless the user has just completed the step | ||
// and then clicked the back button. | ||
if ( ! param && ! detectHistoryNavigation.loadedViaHistory() ) { | ||
flow = removeUserStepFromFlow( flow ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we confirm that this won't break something for an existing signup flow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flow = removeUserStepFromFlow( flow );
was there before.
It used to be always applied. To test that it still works as expected.
I create the user and then just visit /start/user
it should then redirect me to => /start/domains
I am not sure how else to test this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also flows like p2
and p2-new
where the user step isn't the first step. I briefly tried them and the step exclusion still seems to work as expected.
Co-authored-by: Marin Atanasov <[email protected]>
This makes it so that iPhone 5 screen size doesn't have to scroll
@@ -50,41 +56,60 @@ function ContinueAsUser( { currentUser, redirectUrlFromQuery, onChangeAccount } | |||
// like that, but it is better than the alternative, and in practice it should happen quicker than | |||
// the user can notice. | |||
|
|||
const notYouText = isSignUpFlow | |||
? translate( 'Not you?{{br/}} Sign out or log in with {{link}}another account{{/link}}', { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ String reuse speeds up translation and improves consistency. The following string might make a good alternative and has already been translated 27 times:
translate( 'Not you?{{br/}}Log in with {{link}}another account{{/link}}' )
ES Score: 6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have much to add regarding code here 👍 This looks like solid work.
I'd defer the final review to someone from @Automattic/ganon as it falls under the signup / onboarding experience.
? translate( 'Not you?{{br/}} Sign out or log in with {{link}}another account{{/link}}', { | ||
components: { | ||
br: <br />, | ||
link: ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we declare this component separately? It seems to be duplicated across the 2 strings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great catch!
Co-authored-by: Marin Atanasov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't able to reproduce the issue seen in #57287. Following the login email links I never found myself on a user step with already filled in details.
I've done some testing and it seems to be working as designed. I am finding it quite confusing and tricky to reason about though, especially the use of the detectHistoryNavigation.loadedViaHistory()
helper. Does this mean there's an intentional difference between the behaviour of using the browser back button and the back button in the framework UI? This seems quite confusing to me.
You may have already investigated this, but can the .status === 'completed'
flag be used instead of adding a new ?user_completed
query param? We're not always good at propagating query parameters between steps, so it might be better to rely on the data in the redux store.
client/signup/steps/user/index.jsx
Outdated
@@ -367,6 +385,10 @@ export class UserStep extends Component { | |||
return this.props.step && 'completed' === this.props.step.status; | |||
} | |||
|
|||
userCreationCompletedWithAndHasHistory( props ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be clearer without the With
?
Am I interpreting this identifier correctly if I insert a pause like this? "user creation completed, and has history"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call
// Remove the user step unless the user has just completed the step | ||
// and then clicked the back button. | ||
if ( ! param && ! detectHistoryNavigation.loadedViaHistory() ) { | ||
flow = removeUserStepFromFlow( flow ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is also flows like p2
and p2-new
where the user step isn't the first step. I briefly tried them and the step exclusion still seems to work as expected.
@@ -135,6 +136,19 @@ export class UserStep extends Component { | |||
} | |||
} | |||
|
|||
componentDidUpdate() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in componentDidMount
instead of on each prop update? Feels like we'd only want to potentially redirect on first mount.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried that and it didn't quite work as expected for me.
It seems that in some cases the component is already mounted and this part gets skipped.
…alypso into fix/start-user-logged-in
We don't need this condition any more since componentDidMount did the trick
This reverts commit ead51c7.
Thanks for the review and testing @p-jackson and @tyxla I think this PR is ready to go.
This PR tries to fix this experience for mobile, by sending a user the screen where it is clear that they are already logged in. The reason why we need redirect in js is that in the current flow, even if we just created a new user the browser doesn't have the full awareness that the user is logged in yet. If the user is logged in already and they try the Hopefully the above makes sense 😅 |
That does make sense now thank you. The signup framework is unique in how it's able to deal with the semi-logged state of the user. It's not surprising that the "Continue As User" screen only works after a full page refresh. I haven't found any issues with this change in my testing, so no reason to hold off merging due to known bugs; it all seems to be working well. I am worried about the extra complexity that's being added to achieve this experience, but I'm not in a good position to judge the importance of this change to the mobile experience. Feel free to merge if this is going to be better for mobile web users. |
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/7017513 Hi @enejb, could you please edit the description of this PR and add a screenshot for our translators? Ideally it'd include this string: Thank you in advance! |
Translation for this Pull Request has now been finished. |
* Start User: Add Continue as user to the sign in flow Instead of showing a notice this lets is not very helpful Let's show the user a Continue as User component. * Bump the spacing to 48px between the heading and text * Center the Heading on mobile on sign up * Only redirect if the user has used History Navigation This is done so that we don't accidentally send the user to the continue page when they are creating a new user account * Fix firefox issue with the back button On second try in Firefox the back button didn't work any more. this fixes it by making sure that we don't remove the sign in step if there the page as loaded via history. * Simplfy optional chaining Co-authored-by: Marin Atanasov <[email protected]> * Fix lint error * removed not needed function return * Update variable code style * Add handleOnChangeAccount function + track click * Continue as user Sign out text variation * Improve the visibility on iPhone 5 This makes it so that iPhone 5 screen size doesn't have to scroll * Add comment to explain the rational of the magic numbers. * remove the redundent attribute. Co-authored-by: Marin Atanasov <[email protected]> * DRY translation components * remove userCreationCompletedWithAndHasHistory since We don't need this condition any more since componentDidMount did the trick * Revert "remove userCreationCompletedWithAndHasHistory since" This reverts commit ead51c7. * Update the method name to remove With Co-authored-by: Marin Atanasov <[email protected]>
Instead of showing a notice that is not very helpful when the user clicks the browser back button on the domain screen.
Let's show the user a Continue as User component instead.
Changes proposed in this Pull Request
When the "user has completed the registration step" has been detected. We redirect the user to the registration form (same url) but with the ?user_completed=1 query parameter in the URL that helps us know if a user really want to be on this page. Usually, we skip the user registration step if they are already logged in.
Testing instructions
See
Screen.Recording.2021-11-17.at.6.10.26.PM.mp4
/start
Create a new user.
Once you are on the domain Screen. Use the browser back button.
Notice that you are logged in as a newly created user.
Other things to test
visit /log-in and /log-in/new notice that it looks as expected.
Related to #57287