with Imagination: by Dustin Diaz

./with Imagination

A JavaScript, CSS, XHTML web log focusing on usability and accessibility by Dustin Diaz

Yahoo! Store gets rich interface with YUI

Monday, October 23rd, 2006

As another case of Yahoo! eating it’s own dog food, the Yahoo! Merchant Solutions team (not to be confused with Y! Shopping) has put together two new setup wizards to help design your store and add items into your product database.

As a UI Engineer on the project I opted to make the Yahoo! User Interface utilities part of the toolkit we would be sporting to aid development and focus on product features rather than browser bugs and limitations.

My specific area of development was channeled into the Design Wizard which allows a merchant to choose between various custom designed templates or pick a generic design with modified colors and/or layouts. My utilities of choice were heavily influenced by the tasks that needed to get done, and with that said, here is a brief overview of how I included each one into our application.

DOM Collection

I used the DOM Collection util to essentially manage styles in the DOM by getting and setting the various colors of the template when choosing a particular color palette (theme).

color palette chooser

What this basically means is that you can go from choosing one layout such as the following:

Layout one screenshot

To something else that might appeal to another:

Layout two screenshot

Event Manager

The second (and perhaps obvious) utility of choice is the Event manager which almost always seems to go hand-in-hand with the DOM utility. This made for simple event attachment by allowing me to batch events to several elements at once:

Batching Events to an HTMLElement Collection

Event.on(
    Dom.get('color-list').getElementsByTagName('li'),
    'click',
    this.swapColors
);
Event.on(
    Dom.get('layout-list').getElementsByTagName('li'),
    'click',
    this.swapLayout
);

There are of course other hidden gems in the event utility that aren’t so obvious such as its ability of cleaning up after yourself when you leave the page to avoid memory leaks…. which essentially means that any events registered through the utility will be cleaned up automatically by the utility (with the exception of anonymous functions I believe).

Animation

Let me be the 1,000th person to say this; Not all animation is tasteful animation. This is perhaps why we went through several iterations of what constitutes a helpful animation. Often times when modifying the DOM when a user least expects to see a change, that may very well be the best time to add a bit of animation or a doohicky of some sort to let the user know that something is happening. Yes, it is slowing down the process, but with good intentions. Although some may argue that anytime you’re purposely slowing down the process, you’re burdening the user experience. In this particular case I believe it helps usability and gives a clearer understanding to the user of what’s happening on a level that is more beneficial than harmful.

As you can see in the following screen we’ve added a carousel of custom designed templates using the Animation utility that will move from side to side as you paginate through the gallery. Just an FYI: this was indeed the same carousel that inspired Bill Scott to roll out his YUI Carousel.

Layout Carousel

Then upon clicking any given template from the gallery chooser, your preview data is then fetched and loaded into the document… (segue to Connection Manager).

Ajax!!!

Or as we like to call it, the Connection Manager.

Loading your site layout

This made writing an Ajax application 1,000 times easier than I would have ever wanted to invest time into. Albeit the few differences among our A-grade list of browsers and how they have completely different API’s for dealing with behind the scene requests (xmlHttpRequest), the intelligence behind the Connection Manager made it the best Ajax API I’ve ever worked with. Perhaps my favorite convenient method is Connect.setForm(formName) which essentially allows you to set up your name/value pairs and send them with the connection without having to concat some string together.

My second favorite feature of the Connection Manager is that you can specify file uploads simply by passing in a flag (true) to the setForm method as follows:

File Uploads with Connect

Connect.setForm(
    'uploader',
    true
);
var c = Connect.asyncRequest(
    'POST',
    uri,
    {
        success : function() {  },
        failure : function() {  },
        timeout : 5
    }
);

Does this come with Web Standards?

I would say with our pragmatic approach toward achieving a semantic platform for our merchants, we’ve done a pretty damn good job. Having gone through several iterations of design specifications and the needs of a merchant and their customers, we ultimately came up with a solid html structure that would support several layouts and themes without hindering what the real-world would call a waste of time. After all, why would merchants and buyers EVER care about semantic markup and “Web Standards.” Half the time I could care less as I completely agree with Jeff Crofts second point on five things he’s doing to become a better developer by “getting over web standards.” It’s sometimes a shame when tools and technology take precedence over a good user-experience. However in this case; I think we’ve nailed both.

Other Press

Feel free to check out other postings that have featured our recently launched wizards.

9 Responses to “Yahoo! Store gets rich interface with YUI”

  1. Sam

    I haven’t given YUI a look in the past month or so, but are you stripping out the YAHOO.util namespace just for your code examples, or are they actually gone in the library?

  2. Nate K

    So, since you don’t care, your site should be re-named to ‘Half the time I could care less with Imagination.’ Hehe. Just kidding. I agree wholeheartedly with what you are doing and your approach. I think what you have created is a great tool (interface AND usability). I don’t know much about the Javascript framework being used, but it sure looks like it gets the job done for your needs!

    Looking at the screenhots I think it looks great (and i’m sure it functions great).

    Up next, a videocast of how you did it all ;)

  3. Dustin Diaz

    @Sam: No, the namespaces are still in the library, but rather I like to use shorthands when I can. Eg:

    var Dom = YAHOO.util.Dom;
    var Event = YAHOO.util.Event;

    @Nate: I’ve actually been toying around with changing the tagline of my website, however I can’t seem to come up with anything good. Even thoughts of “[any random phrase here] with Imagination” would perhaps be more accurate of what I’m talking about on a post-to-post basis.

  4. Ajaxian » Yahoo! Store: Rich YUI Version

    [...] [...]

  5. Yahoo! Store gets rich interface with YUI « [REF]

    [...] Link [...]

  6. Nate K

    RE: Dustin
    I want to clarify that I wasn’t taking a jab or anything with the name change idea. I am in the same boat as you, there comes a point where you have to get things done. Your work is excellent and unobtrusive, but im sure someone could nitpick about this, that, or the other. There comes a point where those people simply need to put their weapons down and look at the big picture.

    Does this mean forget about accessibility? Not at all - it just simply means getting things done, in the best manner possible, and to achieve business goals.

    Again, I think what you have created above is incredible….

  7. Fatih HayrioÄŸlu’nun not defteri » Web’den haberler

    [...] http://www.dustindiaz.com [...]

  8. Nick

    This is an awesome show-and-tell, thanks so much for your insight! I wish I could see more of the admin portion, sounds like an exciting update to the Yahoo store platform.

  9. Dekoration

    So, since you don’t care, your site should be re-named to ‘Half the time I could care less with Imagination.’ Hehe. Just kidding. I agree wholeheartedly with what you are doing and your approach. I think what you have created is a great tool (interface AND usability). I don’t know much about the Javascript framework being used, but it sure looks like it gets the job done for your needs!

    Looking at the screenhots I think it looks great (and i’m sure it functions great).

    Up next, a videocast of how you did it all ;)

Get "JavaScript Design Patterns"

"As a web developer, you'll already know that JavaScript™ is a powerful language, allowing you to add an impressive array of dynamic functionality to otherwise static web sites. But there is more power waiting to be unlocked--JavaScript is capable of full object-oriented capabilities, and by applying OOP principles, best practices, and design patterns to your code, you can make it more powerful, more efficient, and easier to work with alone or as part of a team."

Buy JS Design Patterns from Amazon.com Buy JS Design Patterns from Apress

All content copyright © 2003 - 2009 under the Creative Commons License.

Archives | Blog Search