Front-end style guide: Difference between revisions

From OpenHatch wiki
Content added Content deleted
imported>Paulproteus
(Beginning of dhtml style guide)
 
imported>Paulproteus
No edit summary
Line 1: Line 1:
This is how the OpenHatch dynamic HTML avoids common problems.
This is how the OpenHatch dynamic HTML avoids common problems.

'''Note''' that the OpenHatch code does not yet follow this guide. It ought to. Perhaps it can be a release goal in the future.


== If it's not a link, don't make it a link ==
== If it's not a link, don't make it a link ==

Revision as of 19:29, 25 August 2011

This is how the OpenHatch dynamic HTML avoids common problems.

Note that the OpenHatch code does not yet follow this guide. It ought to. Perhaps it can be a release goal in the future.

If it's not a link, don't make it a link

If there's no fallback for non-JS users, don't use the <A> tag.

http://openhatch.org/bugs/issue478 covered a problem where a user was clicking on what appeared to be a link. However,

Don't rely on "return false;"

It is easy to mistakenly use "return false;" at the end of a JavaScript callback when you really mean event.preventDefault(). You can read more about this problem.