Skip to content

open iframe on first run, sign in, animate#4579

Merged
alexgibson merged 1 commit intomozilla:masterfrom
ericawright:master
Feb 3, 2017
Merged

open iframe on first run, sign in, animate#4579
alexgibson merged 1 commit intomozilla:masterfrom
ericawright:master

Conversation

@ericawright
Copy link
Contributor

@ericawright ericawright commented Jan 12, 2017

work-in-progress
@pmac

Description

Add animation to onboarding experience/ firstrun page.
Change sign-up form to sign-in instead
Animation drops user off on about:newtab page

Based on https://dl.dropboxusercontent.com/u/105549/mvp1.framer/index.html

Bugzilla link

https://bugzilla.mozilla.org/show_bug.cgi?id=1322718
https://bugzilla.mozilla.org/show_bug.cgi?id=1333410

@pmac
Copy link
Contributor

pmac commented Jan 13, 2017

Thanks! I'll take a look. Looks like some stuff I'd like @alexgibson to check out as well.

Copy link
Contributor

@alexgibson alexgibson left a comment

Choose a reason for hiding this comment

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

A good start 👍 I left some comments that may hopefully be useful in terms of direction. Will take another look when you're ready.

<div>
<img src="/media/img/firefox/firstrun-horizon/sample.png">
</div>
<a href = "https://www.mozilla.org/en-US/firefox/sync/"> Learn more about Firefox Accounts</a>
Copy link
Contributor

Choose a reason for hiding this comment

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

Use the url helper for internal links e.g. href="{{ url('firefox.sync') }}". Also remove the space either side of the =.

<div id="left-divider">
<p>Sign in to your account and we'll sync the bookmarks, passwords and other great things you've saved to Firefox on other devices.</p>
<div>
<img src="/media/img/firefox/firstrun-horizon/sample.png">
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use the static media helper for all referenced images in templates. This ensures we can use the correctly cached bundle names in production. e.g. src="{{ static('img/firefox/firstrun-horizon/sample.png') }}"

<div>
<div id="scene">
<div class="fxaccounts-container">
<h2 id="title"> Already Using Firefox?</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

Please wrap all text for l10n. I understand this is a test for en-US only, but this is general practise and also saves work further down the road when we decide to start translating the page. e.g. {{_('Already Using Firefox?')}}. Note you also have a stray space here before Already.

Copy link
Contributor

Choose a reason for hiding this comment

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

Should this probably be an <h1> too?

</div>
</div>

<img id="night-sky" src="/media/img/firefox/firstrun-horizon/night-scene/sky.png">
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a blocker seeing as this is just a test, but because these images are all presentation, it might be better they we're a bunch of <div>'s with background images in CSS. At least for now, please include an empty alt="" attribute for each image so that screen readers will avoid reading out the filenames.

{% endblock %}

{% block site_js %}
{% javascript 'site' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

The site bundle should be in the <head> of the page, so things like Google Analytics will work correctly. You would get this kind of setup for the page for free if you extended the firefox/base-resp.html template instead of bare.html. The page is also missing a lot of other meta type info because of this. Switching would require some more work though to get things looking correct again, so it's up to you here...

let skipbutton = document.getElementById('skip-button');

let onVerificationComplete = () => {
scene.setAttribute('sign-in', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

This would be a good use-case for data- attributes?

if (event.propertyName === 'transform') {
window.setTimeout(function () {
window.location.href ="https://github.com/";
// Mozilla.UITour.showNewTab(); // TODO someday
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't working because you're not importing uitour-lib.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

side note - it works now - the issue was permission to access uitour from 127.0.0.1:8111

});
});

scene.setAttribute('sunrise', 'true');
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, use data- attributes here and below.

</div>

<img id="night-sky" src="/media/img/firefox/firstrun-horizon/night-scene/sky.png">
<img id="sky" src="/media/img/firefox/firstrun-horizon/day-scene/sky.png">
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason why these image are no longer SVG too? I see a bunch of @2x pngs in the PR, but they are not being used currently. Might SVG yield a faster page load and better performance?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, I will remove all of the x2 pngs
I suppose it's arguable, but I was working under the impression that SVGs are less efficient, especially when animating.

Copy link
Contributor

Choose a reason for hiding this comment

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

My main concern there is the total page weight using png's. I'll see if we can get this up on a demo server soon and take a look performance-wise.

</div>
<div class="fxaccounts" id="fxa-iframe-config" data-host="{{ settings.FXA_IFRAME_SRC }}" data-mozillaonline-host="{{ settings.FXA_IFRAME_SRC_MOZILLAONLINE }}">
<iframe id="fxa" scrolling="no" data-src="{{ settings.FXA_IFRAME_SRC }}signin?utm_campaign=fxa-embedded-form&amp;utm_medium=referral&amp;utm_source=firstrun&amp;utm_content=fx-{{ version }}&amp;entrypoint=firstrun&amp;service=sync&amp;context=iframe&amp;style=chromeless&amp;haltAfterSignIn=true"></iframe>
<button id="skip-button"> Skip This Step</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Extra space here before Skip

@alexgibson
Copy link
Contributor

It would be nice if this page was responsive too. It's shown on desktop only, but we found the existing /firstrun page does perform better if we make it naturally flow to the browser window. This isn't a blocker for this test though, only if it makes sense and you have time.

<img id="mountains-trees" src="/media/img/firefox/firstrun-horizon/day-scene/mountains-trees.png">
<img id="night-foreground-fox" src="/media/img/firefox/firstrun-horizon/night-scene/foreground-fox.png">
<img id="foreground-fox" src="/media/img/firefox/firstrun-horizon/day-scene/foreground-fox.png">
<img id="scene-blur" src="/media/img/firefox/firstrun-horizon/scene-blur.png">
Copy link
Contributor

Choose a reason for hiding this comment

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

This image is pretty huge - would achieving the same effect be possible with CSS filters perhaps? May well be out of scope in the timeframe here, but just a thought.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CSS filter (blur) slowed down the performance drastically - so this was done to get around that.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a shame 😞

document.getElementById('sunrise').addEventListener('transitionend', function(event) {
if (event.propertyName === 'transform') {
window.setTimeout(function () {
window.location.href ="https://github.com/";
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: space after =

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was temporarily using github as a placeholder, now about:newtab works so has been changed to Mozilla.UITour.showNewTab();

@ericawright
Copy link
Contributor Author

@alexgibson Great Comments, very thorough, thank you so much!

"'unsafe-inline'",
)
CSP_CHILD_SRC = (
'stomlinson.dev.lcip.org',
Copy link
Contributor

Choose a reason for hiding this comment

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

Rather than include this in the list that gets used for production, the newly opened #4581 may be a better approach here (thanks @jpetto!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🎉 it works!

@ericawright
Copy link
Contributor Author

It would be nice if this page was responsive too

It is....well, the modal is not, but the rest is. I'll work on the modal.

@@ -0,0 +1,37 @@
{% extends "bare.html" %}
{% stylesheet 'firefox_new_firstrun' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be in a block called {% block site_css %}{% endblock %}. Currently this is adding the stylesheets before <!doctype html>, which is invalid.

{% extends "bare.html" %}
{% stylesheet 'firefox_new_firstrun' %}
{% block site_js %}
{% javascript 'site' %}
Copy link
Contributor

Choose a reason for hiding this comment

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

This site bundle is currently being loaded twice, as it's already being included in the base-resp.html template which bare.html extends. You can remove this line.

},
'firefox_new_firstrun': {
'source_filenames': (
'js/firefox/firstrun/new-firstrun.js',
Copy link
Contributor

Choose a reason for hiding this comment

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

new-firstrun.js should probably come last in the bundle?


(function (Mozilla) {
'use strict';
let scene = document.getElementById('scene');
Copy link
Contributor

Choose a reason for hiding this comment

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

CircleCI is still failing when running collectstatic (which concatenates and minifies our JS). I'm guessing it's because there is still some ES6 variable names here and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh is that why its failing! I was trying to figure that out - thanks

<div class="fxaccounts-container">
<h1 id="title">{{_('Already Using Firefox?')}}</h1>
<div id="left-divider">
<p>{{_('Sign in to your account and we\'ll sync the bookmarks, passwords and other great things you\'ve saved to Firefox on other devices.')}}</p>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: for consistency with other page copy on mozorg you can use curly quotes here instead of escaping.

<div id="left-divider">
<p>{{_('Sign in to your account and we\'ll sync the bookmarks, passwords and other great things you\'ve saved to Firefox on other devices.')}}</p>
<div>
<img src="{{ static('img/firefox/firstrun-horizon/sample.png') }}">
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add an empty alt=""

</div>
</div>

<img id="night-sky" alt=" Night Sky" src="{{ static('img/firefox/firstrun-horizon/night-scene/sky.png') }}">
Copy link
Contributor

@alexgibson alexgibson Jan 18, 2017

Choose a reason for hiding this comment

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

I don't think adding alt text for these images makes a whole lot of sense, since they are more just for presentation, and having a screen reader read through these as a list won't really add a lot of meaning to the page imho. Please use empty alt="" attributes.

if detect_channel(version) == 'alpha':
template = 'firefox/dev-firstrun.html'
elif show_40_firstrun(version):
#New onboarding animation
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: fix indentation

'css/firefox/firstrun/new-firstrun.less',
'css/base/mozilla-fxa-iframe.less',
),
'output_filename': 'css/firefox_new-firstrun-bundle.css',
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: fix indentation

overflow: hidden;
margin: auto;
position: absolute;
top: 0; left: 0; bottom: 0; right: 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: please use a separate line per property

if detect_channel(version) == 'alpha':
template = 'firefox/dev-firstrun.html'
elif show_40_firstrun(version):
#New onboarding animation funnecake
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this is causing the flake 8 error: bedrock/firefox/views.py:385:13: E265 block comment should start with '# '

@alexgibson
Copy link
Contributor

Hi @ericawright - we just landed #4567 which adds CSS linting to our CI. Would you mind rebasing this branch against up to date master so we can use that here in this PR? There are some instructions on how to rebase here if you need: http://bedrock.readthedocs.io/en/latest/contribute.html#git-workflow

Thanks!

@ericawright
Copy link
Contributor Author

@alexgibson has been rebased

</div>
<div id="firefox-logo"></div>
<div class="fxaccounts" id="fxa-iframe-config" data-host="{{ settings.FXA_IFRAME_SRC }}" data-mozillaonline-host="{{ settings.FXA_IFRAME_SRC_MOZILLAONLINE }}">
<iframe id="fxa" scrolling="no" data-src="{{ settings.FXA_IFRAME_SRC }}signin?utm_campaign=fxa-embedded-form&amp;utm_medium=referral&amp;utm_source=firstrun&amp;utm_content=fx-{{ version }}&amp;entrypoint=firstrun&amp;service=sync&amp;context=iframe&amp;style=chromeless&amp;haltAfterSignIn=true"></iframe>
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey, for FxA metrics could we please specify a different entrypoint= value here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes :)

@alexgibson
Copy link
Contributor

alexgibson commented Jan 24, 2017

Hi @ericawright - I pushed your branch to a demo for testing:

https://www-demo1.allizom.org/en-US/firefox/51.0/firstrun/?f=99

I also created a mozorg bug to track this change here:

https://bugzilla.mozilla.org/show_bug.cgi?id=1333410

@vladikoff
Copy link
Contributor

@alexgibson did you want that deploy to use one of our FxA dev boxes? Right now it is using production and the form does not show up.

@alexgibson
Copy link
Contributor

A couple of things I noticed:

  • On the demo the animation starts before the assets have finished loading.
  • The page is missing a title. Currently it reads " — Mozilla".
  • The page currently weights over 4MB on an empty cache. Could the image be compressed? (tinypng.com), Does the page need 4 different weights of Fira?

@alexgibson
Copy link
Contributor

@alexgibson did you want that deploy to use one of our FxA dev boxes? Right now it is using production and the form does not show up.

Ugh, I forgot the iframe doesn't work on our ad-hoc demo deploys. I'll need to switch over to one of our regular demo instances. Thanks for the reminder.

@ericawright
Copy link
Contributor Author

@alexgibson Thank you!
I'm in the process of getting SVG assets - hoping that lightens the load a bit?

@alexgibson
Copy link
Contributor

I'm in the process of getting SVG assets - hoping that lightens the load a bit?

👍 🎉

@ericawright
Copy link
Contributor Author

ericawright commented Jan 24, 2017

On the demo the animation starts before the assets have finished loading.

I've also noticed that - which (along with being not pretty) causes the modal to not show up at all - will change that.

@alexgibson
Copy link
Contributor

OK, this is now up on demo1: https://www-demo1.allizom.org/en-US/firefox/51.0/firstrun/?f=99

@vladikoff
Copy link
Contributor

@alexgibson hm our stage deploy does not accept that origin either, not sure if it should.

@alexgibson
Copy link
Contributor

alexgibson commented Jan 24, 2017

@alexgibson hm our stage deploy does not accept that origin either, not sure if it should.

We've previously been able to test on demo1 through to demo5, is this a recent change?

I also noticed our CSP is blocking the iframe, which is something we probably need to fix:

Content Security Policy: The page’s settings blocked the loading of a resource at https://accounts.stage.mozaws.net/signin?utm_campaign=fxa-embedded-form&utm_medium=referral&utm_source=firstrun&utm_content=fx-51.0&entrypoint=firstrunFunnel99&service=sync&context=fx_firstrun_v2&style=chromeless&haltAfterSignIn=true&origin=https%3A%2F%2Fwww-demo1.allizom.org (“frame-src https://*.optimizely.com https://www.googletagmanager.com https://www.google-analytics.com https://www.youtube-nocookie.com https://trackertest.org https://www.surveygizmo.com https://accounts.firefox.com https://accounts.firefox.com.cn https://www.youtube.com https://cse.google.com”).

@jpetto
Copy link
Contributor

jpetto commented Jan 24, 2017

FWIW, FxA stage is currently working on demo4, though we did have to adjust the deis config to get CSP compliant.

@alexgibson
Copy link
Contributor

alexgibson commented Jan 24, 2017

FWIW, FxA stage is currently working on demo4, though we did have to adjust the deis config to get CSP compliant.

Thanks @jpetto - I logged into deis and set the CSP environment variable for https://accounts.stage.mozaws.net. The iframe is now loading as expected on demo1.

@vladikoff - it would be great to try and get this working on demo1-5 if possible. Is that something you can do without too much effort?

@alexgibson
Copy link
Contributor

alexgibson commented Jan 31, 2017

From a UX perspective, if the user does not already have an account and instead chooses "sign up", should the "skip this step" button be hidden once the user starts the sign up flow? (is this possible?).

skip-button

@alexgibson
Copy link
Contributor

I've tested the FxA flow on demo1 using these instructions and both sign in and sign up seem to be working as expected. Other than a couple of things I noticed above, it seems to be working nicely 👍

@ericawright
Copy link
Contributor Author

should the "skip this step" button be hidden once the user starts the sign up flow? (is this possible?).

Is it possible, and it's a good idea!

@alexgibson
Copy link
Contributor

alexgibson commented Jan 31, 2017

should the "skip this step" button be hidden once the user starts the sign up flow? (is this possible?).

@jpetto - any idea if it's possible to detect when the signup flow has begun, but not yet at the verification step? If feels like the answer is probably no, but this would be a nice UX improvement.

@alexgibson
Copy link
Contributor

@ericawright - at the very least if looks like you could hide the button when it gets to the verification step: https://github.com/mozilla/bedrock/blob/master/media/js/base/mozilla-fxa-iframe.js#L133

@ericawright
Copy link
Contributor Author

@alexgibson yeah, I'm using the signupMustVerify callback now. I don't think I can at the "choose what to sync" stage

@alexgibson
Copy link
Contributor

@ericawright - could you please add a couple of tests for the view logic for these funnelcakes? You can see some existing examples here: https://github.com/mozilla/bedrock/blob/master/bedrock/firefox/tests/test_base.py#L364-L388. Thanks!

@ericawright
Copy link
Contributor Author

ericawright commented Jan 31, 2017

During the sign-up flow, the "back" button appears cropped

So this styling is inside of the iFrame, and I'm unable to edit it, or apply my own styling to it. I'm not certain if it's the styling from the test iframe only, or if it would be on the actual one too. I'm not entirely sure who to ask about this? @vladikoff?

npm-debug.log Outdated
@@ -0,0 +1,27 @@
0 info it worked if it ends with ok
Copy link
Contributor

Choose a reason for hiding this comment

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

Think you may have committed this accidentally?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like this may have crept back again

@alexgibson
Copy link
Contributor

Erica, unless there's anything outstanding could you please squash the commits here, and also reference 'bug 1333410' in the commit message? If you include something like "[fix bug 1333410] - your commit message" it will also auto-close the bugzilla bug when this merges.

(If you're not used to doing any of this, I can also probably do it for you). Thanks!

<iframe id="fxa" scrolling="no" data-src="{{ settings.FXA_IFRAME_SRC }}signin?utm_campaign=fxa-embedded-form&amp;utm_medium=referral&amp;utm_source=firstrun&amp;utm_content=fx-{{ version }}&amp;entrypoint=firstrunwow{{ funnelcake_id }}&amp;service=sync&amp;context=iframe&amp;style=chromeless&amp;haltAfterSignIn=true"></iframe>
<button id="skip-button">{{_('Skip this step')}}</button>
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: please fix indentation

{% endblock %}

{% block content %}
<div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: this <div> doesn't seem to be used by anything?

template = render_mock.call_args[0][1]
eq_(template, ['firefox/firstrun/firstrun-horizon.html'])

# New Firstrun Wow-moment funnelcake tests
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we please add another test here just to make sure the control page is shown for f=98? thanks

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, nevermind I see you have one below 👍

@alexgibson
Copy link
Contributor

Other than the couple of nits above, this is an r+ from me.

Fwiw, I seem to be getting a JS error when trying to create a new account on the demo server. The error originates from the FxA iframe code however, so I don't think it has anything to do with this PR directly. It was working ok when I tried on Tuesday.

This is the error: https://pastebin.mozilla.org/8972345

@alexgibson
Copy link
Contributor

Fwiw, I seem to be getting a JS error when trying to create a new account on the demo server. The error originates from the FxA iframe code however, so I don't think it has anything to do with this PR directly. It was working ok when I tried on Tuesday.

I popped into #fxa on IRC and they confirmed and fixed the error on staging. Tested again and things are working as expected 😄

@ericawright
Copy link
Contributor Author

@alexgibson thanks for all that. There were a few changes yesterday evening. The timing has changed on the animations and the landscape was split into two images to get some more depth during zoom in. After this, there should be no more changes!

@alexgibson
Copy link
Contributor

New animation looks good 👍

Please remove the npm-debug.log file, then rebase & squash and we'll be good to merge. Great work @ericawright!

@ericawright ericawright force-pushed the master branch 3 times, most recently from 9eeed67 to 0ee7912 Compare February 2, 2017 19:50
@ericawright ericawright force-pushed the master branch 2 times, most recently from 96bc2d6 to 645b187 Compare February 2, 2017 20:41
@alexgibson alexgibson merged commit e8686a5 into mozilla:master Feb 3, 2017
@vladikoff
Copy link
Contributor

Nice! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants