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

Social Signup: Handle the case where users block third-party cookies/data #13983

Merged
merged 14 commits into from
May 29, 2017

Conversation

pento
Copy link
Contributor

@pento pento commented May 12, 2017

This pull request addresses #13553 by disabling the Google signup button, and showing an error message, when 3rd party cookies are disabled:

screen shot 2017-05-12 at 4 10 22 pm

Testing instructions

  1. Run git checkout fix/13553-signup-3rd-party-cookies and start your server, or open a live branch
  2. Open the Social Signup page
  3. Check that the "Continue with Google" button is enabled, and there is no error message.
  4. In your browser settings, enabled the "Block third-party cookies" setting.
  5. Refresh the Social Signup page.
  6. Check that the "Continue with Google" button is disabled, and there is an error message.

Reviews

  • Code
  • Design
  • Product

@pento pento added [Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Type] Enhancement labels May 12, 2017
@matticbot
Copy link
Contributor

@pento pento self-assigned this May 12, 2017
@matticbot matticbot added the [Size] M Medium sized issue label May 12, 2017
@pento
Copy link
Contributor Author

pento commented May 12, 2017

I just hacked in some CSS for the error message, I would appreciate a pointer as to what CSS rules I should actually be using. :-)

@pento pento added this to the Social Signup: M1 milestone May 12, 2017
@@ -19,6 +19,8 @@ class GoogleLoginButton extends Component {
fetchBasicProfile: true,
};

state = { error: false };
Copy link
Member

Choose a reason for hiding this comment

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

It should be initialised to either null or an empty string ``.

@@ -45,6 +47,10 @@ class GoogleLoginButton extends Component {
return this.initialized;
}

this.setState( { error: '' } );
Copy link
Member

Choose a reason for hiding this comment

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

Can it be initialized more than once? If not then we can remove this state change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, initialize() can be called multiple times - this.initialized won't be set until the gapi instance is properly initialised.

@@ -73,26 +91,33 @@ class GoogleLoginButton extends Component {
}

render() {
let buttonDisabled = false;
Copy link
Member

Choose a reason for hiding this comment

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

It can be simplified to:

const buttonDisabled = Boolean( this.state.error );

this.setState( { error: translate( 'Your privacy settings are blocking us from connecting to your Google account. ' +
'Please enable "third-party cookies" in your browser or operating system, or log in with an email address instead.'
) } );
return null;
Copy link
Member

Choose a reason for hiding this comment

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

@Tug should we return rejected Promise in this case, too?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I believe we can simply remove that return statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If i removed the return null, the console shows a JS error:

Object {error: "idpiframe_initialization_failed", details: "Failed to read the 'localStorage' property from 'Window': Access is denied for this document."}

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 it's fine to show an error in the console here. if we want to hide it in a debug() call for instance, that should be done by calling catch on the promise returned by this.initialize().

@gziolo
Copy link
Member

gziolo commented May 12, 2017

I just hacked in some CSS for the error message, I would appreciate a pointer as to what CSS rules I should actually be using. :-)

I guess it needs some tweaks :)

I left my comments, those are only nitpicks. It works as advertised. Let's hear from designers before we merge this one.

@fabianapsimoes
Copy link
Contributor

I wonder if we could be more proactive about this, and display the error message without a click? It's not a big issue if it's going to mean a lot more work, but it'd be nicer to disable the social buttons from start if they can't be used.

Also, since we're on signup, the copy should probably say "or sign up with an email address" instead of "or log in with an email address".

cc @breezyskies for design input. I'm not sure I've seen errors associated with buttons displayed like we're doing in this PR. I suppose we usually go with a notice in cases like this?

@fabianapsimoes fabianapsimoes added [Status] Needs Author Reply and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 12, 2017
@fabianapsimoes
Copy link
Contributor

Also, since we're on signup, the copy should probably say "or sign up with an email address" instead of "or log in with an email address".

Updated this with 61efbdd.

@breezyskies
Copy link
Contributor

I'm not sure I've seen errors associated with buttons displayed like we're doing in this PR. I suppose we usually go with a notice in cases like this?

Correct, this would need to be a notice. Given the length of the copy, I don't think we can use global notices in this case, so would need to be the standard notice component.

@Tug
Copy link
Contributor

Tug commented May 12, 2017

I wonder if we could be more proactive about this, and display the error message without a click?

It's already the case, the lib is loaded when the component mounts. I tested it and it seems to work.

@gziolo
Copy link
Member

gziolo commented May 12, 2017

Yes, there is no need to click anything.

@breezyskies
Copy link
Contributor

The downside of that is we're showing an error message to someone who might not even choose to use social signup.

@fabianapsimoes
Copy link
Contributor

Yes, there is no need to click anything.

Hm... Weird, I must have missed something while testing 🤔

Anyway, now that we're talking about using a notice, I have the same concern as Brie. The notice is quite prominent with its size and color, and might distract users from their actual goals (or just generally cause confusion since third-party cookies are not familiar to all users).

Maybe the best would be to indeed only display the error on click.

@gziolo
Copy link
Member

gziolo commented May 12, 2017

What do you think about disable state with tooltip? We could add a small red icon indicating some error inside the button.

@@ -50,3 +50,9 @@
.signup-form__notice.notice {
margin-bottom: 10px;
}

.social-buttons__service-error {
color: red;
Copy link
Contributor

Choose a reason for hiding this comment

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

Color can only use one of our color variables, in this case $alert-red

.social-buttons__service-error {
color: red;
font-size: 11px;
margin: 0 10px 10px 10px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can be shortened to margin: 0 10px 10px; I believe

@davewhitley
Copy link
Contributor

davewhitley commented May 12, 2017

A lot of this text is superfluous.

a8 cw7iehzebaaaaaelftksuqmcc

But, focusing on just the error text:

  • Shouldn't be red
  • Google logo should also looked disabled
  • Probably shouldn't even be there unless they click on the disabled button. Reason is that we don't want to distract users who don't even want to sign up with Google.

I would clean up all of the text I pointed to in the screenshot by doing this:

Or create an account using a social profile. We'll never post without your permission.

[google button disabled state]

Please enable "third-party cookies" to connect your Google account.

[facebook button]

cc @ranh for the shortened error text I wrote

@ranh
Copy link
Contributor

ranh commented May 14, 2017

Nice improvement on that cookies notice @drw158, 👍

Your suggestion also removes "Connect to your existing social profile to get started faster". This sentence is meant to provide additional context for users who will not immediately understand the function or benefit of the "social" buttons. I don't think it's superfluous, so I think we should keep it.

{ this.props.translate(
"Connect to your existing social profile to get started faster. We'll never post without your permission."
) }
{ this.props.translate( 'Connect to your existing social profile to get started faster.' ) }
Copy link

Choose a reason for hiding this comment

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

😞 17 existing translations will be lost with this change.

@matticbot matticbot removed the [Size] M Medium sized issue label May 15, 2017
@drewblaisdell drewblaisdell force-pushed the fix/13553-signup-3rd-party-cookies branch from fd5e5cf to 8084b81 Compare May 24, 2017 18:38
@drewblaisdell
Copy link
Contributor

LGTM. 👍

@drewblaisdell drewblaisdell added [Status] Ready to Merge [Status] Needs Author Reply and removed [Status] Needs Design Review Add this when you'd like to get a review / feedback from the Design team on your PR [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] Ready to Merge labels May 24, 2017
@drewblaisdell
Copy link
Contributor

Actually, we need to fix the tests first. :) I rebased and they are failing due to the import of Popover in social-buttons/google.js.

@pento pento added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. and removed [Status] Needs Author Reply labels May 25, 2017
@pento
Copy link
Contributor Author

pento commented May 25, 2017

That this can even happen is... less than optimal. 🙃

render() {
let classes = 'social-buttons__button button';
Copy link
Contributor

Choose a reason for hiding this comment

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

Another option is:

import classNames from 'classnames';
classNames( 'social-buttons__button', 'button', { disabled: this.state.error } );

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So many magic functions. 😁

@yurynix
Copy link
Contributor

yurynix commented May 25, 2017

Code looks 👍 It works for me in Chrome when I disable "third party cookies" 👍 All tests pass 👍
IMO lets 🚢 it

@gziolo gziolo added [Status] Ready to Merge and removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels May 26, 2017
@pento pento merged commit 9fcffd2 into master May 29, 2017
@pento pento deleted the fix/13553-signup-3rd-party-cookies branch May 29, 2017 00:25
@ranh ranh mentioned this pull request Jul 20, 2017
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Signup & Account Creation All screens and flows for making a new WordPress.com account. [Size] L Large sized issue [Type] Enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet