-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADR 4: Model browser specific values and computations (#106)
- Loading branch information
1 parent
2255935
commit 3b4329a
Showing
3 changed files
with
38 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
[accessibility support baseline]: https://www.w3.org/TR/WCAG-EM/#step1c | ||
|
||
# ADR 4: Model browser specific values and computations | ||
|
||
## Context | ||
|
||
Having decided on [ADR 2](adr-002.md), we will no longer be tied to any one specific browser and are left with the choice of what to do about things that browsers are not aligned on. For example, if Alfa needs to implement an API to perform a given task and a given set of browsers do not agree on how the API should be implemented, Alfa can do several things: | ||
|
||
1. Implement the API the way it is implemented in the _least_ capable browser, in terms of the API, among a given set of browsers. | ||
|
||
2. Implement the API the way it is implemented in the _most_ capable browser, in terms of the API, among a given set of browsers. | ||
|
||
3. Provide several implementations of the API that cover all the different implementations of the API among a given set of browsers. | ||
|
||
Our proprietary accessibility conformance testing engine at Siteimprove takes the second approach in practice as it is usually run within the latest version of the Chrome browser and relies heavily on browser APIs. Other tools that operate with the concept of an [accessibility support baseline][] will typically take a combination of the first and second approach where some browser APIs are used and then others implemented manually according to the capabilities of the [accessibility support baseline][]. | ||
|
||
The quality shared by the first and second approach is that they both produce just a single implementation of the API, though with potentially different capabilities. However, both approaches suffer from the fact that depending on how the API is implemented, an accessibility issue could be found in either the least or most capable browser, while being missed in the other. As an example, a contrast issue might appear in an older browser that does not support a specific color format, while the contrast would be perfectly fine in a newer browser that does support the specific color format. The third approach avoids this issue entirely by implementing the API in all possible ways for a given set of browsers. | ||
|
||
## Decision | ||
|
||
We will take the third approach described in the previous section and incrementally adopt it throughout Alfa where it makes sense. To do so, we will introduce the concept of _browser specific values_ that model abstract values that can take on multiple concrete values across different sets of browsers. This way, any API that we may want to implement can either return just a single value or a set of browser specific values in the case where the API would behave differently in different sets of browsers. | ||
|
||
To decrease the complexity of working with browser specific values, we will implement them as [monads](<https://en.wikipedia.org/wiki/Monad_(functional_programming)>) and expose a set of operations that allow consumers to perform computations on browser specific values without having to worry about whether they take on one or multiple concrete values. | ||
|
||
## Status | ||
|
||
Accepted. | ||
|
||
## Consequences | ||
|
||
By providing a building block for modelling browser specific values, we are in a position to substantially increase the usefulness of Alfa for individuals and organisations that need results for not just a single browser but a range of browsers, old or new. | ||
|
||
The onus is of course on us, the Alfa development team, to account for misalignment between browsers and to constantly stay on top of it. We must be pragmatic about when and where to account for browser misalignment and find a balance between complexity added and value provided. |