Internal Server Error
what the voices in my head tell me to write
Thursday, May 14, 2009
I have spent the best part of a week working on a drag and drop interaction for the site I am working on. It was one of those things that look relatively easy but turned out to be a nightmare.
The set up was in theory simple. Two <ul>'s containing <li>'s you can drag and drop around both within the lists and from one list to another. Not that hard you might think. The added spice was that the UX guys wanted a swapping sort of thing as you drag the <li> around. As you move over another <li> you see a sort of swapping animation. Not just on drop on dragging over every element.
That complicates matters somewhat. Especially when you drag from one list to another and drop. Does that mean you are adding to the second list or swapping the two around? Well it works that if you drag and drop on top of an element in the second list you swap, if you drop it between elements or at the bottom of the list you add to it.
Then what happens when you completely empty a list? That means invisible placeholders being created and destroyed as you need them. All kinds of complicated stuff.
Lots of work in the end to add about 30 lines of code to Evans original code (which didnt have to worry about empty lists and stuff). The thing about once a year in my ten year career as a web developer I get asked to do drag and drop interactions (thank you macromedia/adobe for saying its easy to do with Dreamweaver and Flash) and none of them work that well.
Drag and drop for web based applications always seems to me to be one of those bells and whistles that managers/ux people like but actually baffles many users. Its also a bitch to get working properly for the developer so I never think its worth the effort.
Permanent link and Comments posted by Rob Cornelius @ Thursday, May 14, 2009