-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
doc(adr): Add non-javascript support adr #1720
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# 21. Supporting Users Without JavaScript | ||
|
||
Date: 2025-02-11 | ||
|
||
## Status | ||
|
||
Accepted | ||
|
||
## Context | ||
|
||
Currently, our application is built with the principle that core functionality should be accessible and usable even without client-side JavaScript. | ||
This aligns with our goal of ensuring a resilient and broadly accessible experience. | ||
|
||
We recognize that "non-JS users" aren't just those with JavaScript disabled, but also include users with slow connections, JavaScript errors, or while the JavaScript is still downloading ([Everyone has JavaScript, right?](https://www.kryogenix.org/code/browser/everyonehasjs.html)). | ||
However, we are now encountering situations where specific features, like the upcoming upload component or the auto-suggest input, require JavaScript to work intuitively. | ||
Our approach needs to address the balance between rich interactive features (requiring JavaScript) and the core usability for all users. | ||
|
||
Our framework Remix is built with progressive enhancement in mind, providing a functional experience even during JavaScript loading or failures. | ||
|
||
## Decision | ||
|
||
We will adopt a [**Progressive Enhancement**](https://developer.mozilla.org/en-US/docs/Glossary/Progressive_Enhancement) strategy for all features. | ||
This means: | ||
|
||
1. **Core Functionality First:** All essential features must be fully functional and accessible without JavaScript. This ensures that every user, regardless of their JavaScript capabilities, can accomplish the primary tasks the application is designed for. | ||
|
||
2. **Enhancement with JavaScript:** JavaScript will be used to _enhance_ the user experience where appropriate. This allows us to add interactive elements, richer interfaces, and improved performance for users with JavaScript enabled. Examples include the auto-suggest input, dynamic form validation, and advanced UI components. | ||
|
||
3. **Graceful Degradation:** If JavaScript fails to load or execute, the enhanced features should degrade gracefully, ensuring that the core functionality remains intact. This might mean a less visually appealing or less interactive experience, but it should never result in broken or inaccessible functionality. Components should be designed in isolation to minimize the impact of JavaScript failures. | ||
|
||
4. **Testing Strategy:** Our testing strategy will include both JavaScript-enabled and JavaScript-disabled scenarios. This will ensure that we are continuously validating the accessibility and functionality of our application for all users. | ||
|
||
This is also suggested by the GOV.UK Service Manual for the governmental area (see [here](https://www.gov.uk/service-manual/technology/designing-for-different-browsers-and-devices) and [here](https://www.gov.uk/service-manual/technology/using-progressive-enhancement)). | ||
|
||
## Consequences: | ||
|
||
- **Positive:** | ||
|
||
- Improved accessibility for users with disabilities, limited bandwidth, or JavaScript disabled/unavailable. | ||
- Increased resilience to network issues and JavaScript errors. | ||
- Simplified testing of core functionality. | ||
- Alignment with best practices for web development. | ||
|
||
- **Negative:** | ||
|
||
- Increased development effort for implementing features in both a non-JS and JS version (though this is mitigated by focusing on core functionality first). | ||
- Potential limitations on the complexity of interactive features in non-JS mode. | ||
- Requires a consistent and disciplined approach to development and testing to ensure adherence to the progressive enhancement strategy. | ||
Comment on lines
+39
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Somehow the pro/con framing at the end feels out of place, but I don't know exactly why. Maybe because these aren't concrete Since the pros are already mentioned there - maybe move the negative points up as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have to say, I like the conciseness of the pro and con arguments here. If someone agrees with you, I'm happy to do what you suggested though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
without JavaScript, what happens when the user enters invalid data? for example, if they enter an option not included in an auto-suggest? or enters an invalid number? is that data saved?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already run the same (or stricter, see post code) validation on the backend before saving (otherwise this would also be a huge security issue).
This also helps with the no-JS case, as rvf consumes the schema violations returned by zod + previously sent data and rebuilds the form. It works so magically that we don't have to think about it..
So: Data is always submitted via POST request on hitting the
SUBMIT
button, the server does the schema validation and redirects to a another page. On invalid data without JS, the same page is returned, this time with errors attached to the offending form fields.