- The Book of Dojo
- The Dojo Book, 0.4
- Part 1: "Introduction"
- Part 2: "Out of the Box" Dojo
- Part 3: "The Dojo Programming Model"
- Part 4: "More on Widgets"
- Part 5: "Connecting the pieces"
- Part 6: "Customizing Dojo Builds for Better Performance"
- Part 7: "Utilities"
- Part 8: "Internationalization and Accessiblity"
- Part 9: "Dojo Community"
- Part 10: "Fresh From The Shed" Dojo
- BookWriting
- Glossary
Dojo Widget Design Principles
Submitted by criecke on Tue, 01/23/2007 - 13:01.
Basically, the design goal of that widgets is that, on top of adding nice functionality to your page, is "don't break anything that would have worked with plain HTML". Don't write a widget that doesn't work on Safari, or that doesn't work with a screen reader, etc. If we listed out what it takes to make sure that we aren't taking a step backwards, it's these things:
Cross browser support
This is something done behind the scenes. Basically, each browser has its own quirks; each widgets ensures that no matter which browser it is loaded into, it functions corrects, and it looks and feels the same way.
Graceful degradation
One of the things that keeps a lot of people away from the more modern, dynamic web pages is the question of whether or not users with old machines or accessibility problems will be able to visit your site. With all the books around nowadays citing these issues as a major drawback of new technology, many web developers forgo progressive design because these books have scared them.
This is why dojo's widgets have been designed to work on top of an existing block of code. Most of the widgets add functionality to existing HTML and, in this way, aren't meant to replace the HTML of your page, but extend it.
This means that even when javascript is disabled in the browser (or you are using a browser that doesn't support javascript), the page will still show up and be usable. So if you were using Dojo's Date Picker widget, on a browser without javascript, it would show up as a select box or maybe a input text area. However, with a modern browser you would have a robust graphical calendar.
Accessibility
Widgets will provide support for screen readers and will be able to be manipulated by the keyboard (in addition to the mouse), so that sight impaired and people with limited mobility can use web pages built with widgets.
Internationalization
By way of example, think about the Dropdown Date Picker widget. Not only does it have to print month names in the browser's local language, but it has to format the date for the user according to local customs (In America you would say 10/20/06 whereas in Japan it would be 2006-10-20)
Expandability
Because of the nature of object-driven code, you can create an entirely new widget (or simply add features to one) based on a pre-written widget, without duplicating any of the previous code. This is because you can create a new widget using an existing one as the framework for it, and then simply expand on what is already there, or if needed, replace existing parts without changing the original file.
