Share
Embed
Touch Football
Rebuilding Yahoo Fantasy Football for the Modern Web
skippykawakami
November 07, 2013
Transcript
42 slides
-
Touch Football Rebuilding Yahoo Fantasy Football for the Modern Web
Sunday, November 10, 13 We launched a major redesign of Fantasy Football this year (2013), so here are some of the lessons learned on that project, and some of the ways we used YUI. I know my last talk was about rebuilding Fantasy Football for touch devices, but I promise it’s all new content, though it’s fair to say... -
Sunday, November 10, 13 ... I am the “Fast and
Furious” of tech conference speakers. -
1. Goals 2. Delegating, Tapping, Confessing 3. Keyboard Accessibility 4.
Raves vs. Clown Socks (or: I Go Insane) 5. Questions Sunday, November 10, 13 -
Great on all three screens But... I thought it already
did. Sunday, November 10, 13 We wanted to make Fantasy Football work on all three screens: Desktop, tablet and phones... But didn’t we do that already. Well not really, we got was... -
It “works” on touch devices Sunday, November 10, 13 Something
that just “works” on touch devices. -
Chapter 5: Sunday, November 10, 13 Here’s a few slides
from my last talk to illustrate the problems we had. -
scroll gesture Sunday, November 10, 13 Scroll if the user’s
finger doesn’t pause while moving (“doesn’t pause” means a touchmove event within 25ms of touchstart. You have to allow for a tiny bit of pausing. 25ms isn’t set in stone, but it seemed to work the best in informal testing). -
dragging gesture PAUSE FOR AT LEAST 25ms Sunday, November 10,
13 We only allow the drag to start if you pause for at least 25ms. So we’re using tiny, subtle variances in user action to determine user intent, which is pretty close to mind reading. Actually, technically it’s a variation on “cold-reading”. But it’s imperfect at best... -
finger tip 4: Reduce frustration with E.S.P. Eliminate frustration with
great UI. Sunday, November 10, 13 ... much better is to have a UI that doesn’t require psychic powers, by clearly indicating to the user what areas they can expect drag interactions to occur, and what areas they can expect scroll interactions to occur. -
ESP is for chumps Sunday, November 10, 13 This year
we wanted to skip the ESP and go straight for Great UI. -
It “works” on touch devices Sunday, November 10, 13 So
let’s change this... -
example #1 what we came up with Sunday, November 10,
13 We replaced Drag and Drop, which confuses the drag action with the scroll action on touch devices -
example #2 alternatives Sunday, November 10, 13 We had other
alternative input methods too, something made easy with YUI’s attributes and YUI’s modular approach to building web apps. -
this._handlers.rowtap = table.delegate( "rosterswapper|click", this.handleRowTap, "tbody tr.editable", null, this );
Sunday, November 10, 13 For performance, we delegated nearly everything. The result is a roster that initializes practically instantly. When cached, it can initialize in under 100ms, below the threshold of perceptibility. -
this._handlers.rowtap = table.delegate( "rosterswapper|click", this.handleRowTap, "tbody tr.editable", null, this );
Sunday, November 10, 13 But notice the “click”? That’s not good for touch devices, it forces a 500ms delay between the user’s action and the result, way too long. -
this._handlers.rowtap = table.delegate( "rosterswapper|tap", this.handleRowTap, "tbody tr.editable", null, this );
way better! Sunday, November 10, 13 So use “tap” instead of “click” wherever you can (basically wherever you don’t need to worry about users double-tapping to zoom in). -
It works for everyone. Sunday, November 10, 13 Our old
Drag and Drop rosters had very poor keyboard support. Our new rosters have great keyboard support -
example #4 keyboard accessibility Sunday, November 10, 13 You can
use the tab key, or the up and down arrows to select rows, the enter key to activate it, arrows or tabs to select destinations, and you can esc out of the interaction. -
this._handlers.rowenter = table.delegate( "rosterswapper|key", this.handleRowKey, "enter,38,40,tab,esc", "tbody tr.editable", null, this
); Sunday, November 10, 13 Adding key support is easy: Just declare the keys you’re listening for (note: like everything else, you can delegate keyboard support) -
this._handlers.rowenter = table.delegate( "rosterswapper|key", this.handleRowKey, "enter,38,40,tab,esc", "tbody tr.editable", null, this
); Sunday, November 10, 13 Here’s how you declare which key’s you’re listening for -
// allow user to esc out of editing mode if(e.keyCode
=== 27) { if(self.isEditing()) { if(self.get("swapmethod") === "place") { self.exitPlaceEditMode(); } else { self.exitEditMode(); } } return; } Sunday, November 10, 13 And here’s an example of using them in action. In this case, this is using the esc key to exit the interaction. -
The Firefox Thing A story where I go insane Sunday,
November 10, 13 So we had a lot of complaints about poor scrolling performance in Firefox. -
Guideline Don’t use fixed position backgrounds! Sunday, November 10, 13
I figured I knew the issue, it’s the fixed position backgrounds. That’s a guideline, right? Well, wrong, but before we get into that, time for a quiz. Oh, and I’m going to sound insane asking you this question: -
#clownsocks Sunday, November 10, 13 The correct answer is clown
socks. Tweet it. #clownsocks -
This shows paint rectangles in Firefox’s developer tools. It’s awesome.
Sunday, November 10, 13 This shows paint rectangles in Firefox’s developer tools. It’s awesome. -
You want to see this “clown socks” when you scroll,
it means it’s only repainting new content. Sunday, November 10, 13 -
But we were getting the flashing, colored strobe- light “rave”,
which means it’s re-painting every module over and over while scrolling Sunday, November 10, 13 -
Example #7 Rave on Yahoo Sports... or is it? Sunday,
November 10, 13 But the non-fantasy site wasn’t getting a rave, and they had fixed position backgrounds too. How come? -
Guideline Don’t use fixed position backgrounds? Sunday, November 10, 13
Wait, so what’s the guideline now? -
By removing the fixed-position backgrounds on the modules, and leaving
the page’s fixed-position background, we got our clown socks back. Sunday, November 10, 13 -
Guideline Don’t follow guidelines. Sunday, November 10, 13 Guidelines are
a relic of an earlier web. The modern web has modern browsers with modern tools. -
Other Tools FPS Meter on Chrome Chrome Paint Rectangles Continuous
Repainting Frame Profiling Secret Firefox FPS Meter! Sunday, November 10, 13 Tools such as these. BTW, the secret Firefox FPS meter is layers.acceleration.draw-fps in about:config. -
Guideline Don’t follow guidelines, follow measurements. Sunday, November 10, 13
So those rules of thumb about how to optimize page speed? Throw a lot of them out, and use the browser’s tools to find out where your page might be having problems. -
We are SO hiring! This is a great team, please
consider joining us Sunday, November 10, 13 We’re hiring. Email [email protected], and mention me. I’m Mark.