Dataviz accessibility review: what we can learn from the Norwegian 2023 election graphs
Tags: a11y, datascience, frontend, ux
Published: 2023-09-13 16:55:44

This was [first posted on my blog: fossheim.io](https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/).

--

<p>During the 2020 presidential election night in the United States, I <a href="https://fossheim.io/writing/posts/accessible-dataviz-us-elections/">reviewed the data visualizations used by the major US news networks</a>, and used it to illustrate some dataviz accessibility dos and don’ts.</p>
<p>Now that Norway had its local elections (we were voting for a new regional and city government), it's time for a repeat of the concept and take a closer look at the dataviz accessibility of the graphs used in the Norwegian media.</p>
<p>Earlier this week the Norwegian news NRK reported that <a href="https://www.nrk.no/innlandet/kommunane-sine-nettsider-er-for-darleg-lagt-til-rette-for-svaksynte_-blinde-og-dyslektikarar-1.16544231?fbclid=IwAR2fER5zytJ41NmDGjHCtfFSrJZ-TzvzhzUQWitVfJOSENkJqkoYOMyoN8w">none of the Norwegian municipalities were conforming to web accessibility requirements</a>, so I was definitely curious how the different charts would perform.</p>
<h2>Scope</h2>
<p>During the election night, I inspected the following websites:</p>
<ul>
<li><a href="https://valgresultat.no/valg/2023/ko">valgresultat.no</a>, the official results page by Valgdirektoratet (the electoral directorate)</li>
<li><a href="https://www.nrk.no/valg/2023/resultat/">NRK.no's dashboard</a>, created by the state-owned public broadcast</li>
<li><a href="https://www.vg.no/valgnatt/2023/ko">VG's dashboard</a>, a popular privately-owned newspaper</li>
<li><a href="https://www.aftenposten.no/norge/politikk/i/gEAOe9/valg-2023-valgresultater-fra-kommunevalget-og-fylkestingsvalget#/norge">Aftenposten's dashboard</a>, another popular private newspaper</li>
<li><em>Note: I don't currently work with/have a relationship to these companies, I picked their dashboards because they're popular websites and the first ones that up when I looked for the election results.</em></li>
</ul>
<p>And paid attention to:</p>
<ul>
<li>Screen reader (VoiceOver) behavior</li>
<li>Focus order and keyboard interaction</li>
<li>Visual elements such as color contrast</li>
<li>Semantics, labels, names, and ARIA best practices</li>
<li>Understandability of the data and interactions</li>
<li>Chart controls</li>
</ul>
<p>For client work I would test and review these areas in-depth, each with their own set of criteria, relate them back to WCAG where relevant, and also assess how the page frame and other elements on the page influence the chart accessibility.</p>
<p>For this article, however, I mainly focused on finding examples that:</p>
<ul>
<li>Illustrate some of the important dataviz accessibility best practices, or</li>
<li>Highlight common or interesting accessibility mistakes, or</li>
<li>Explain certain accessibility concepts</li>
</ul>
<p>And to not overcomplicate the article, the websites were only tested in Safari and with VoiceOver.</p>
<p>Now, let's dive into some of the findings 👇🏻</p>
<h2>Data visualizations require accessibility work</h2>
<p>When it comes to web accessibility, writing semantic HTML will get you a long way already.</p>
<p>For example, if you develop a website and do things like picking <code>&lt;button&gt;</code>s for buttons, adding <code>alt</code> text to your images, structuring your content with heading elements (eg: <code>&lt;h1&gt;</code>, <code>&lt;h2&gt;</code>), then you have already started the work of making your website more accessible.</p>
<p>It won't necessarily be WCAG compliant or lead to a good and equal experience for disabled people. Typically more accessibility work is needed for that (and not just from the development side), but it does create a solid base. For example:</p>
<ul>
<li><code>&lt;button&gt;</code>s can by default be activated by clicking them, pressing enter <em>(key down)</em>, or releasing space <em>(key up).</em></li>
<li><code>alt=&quot;...&quot;</code> text on an <code>&lt;img&gt;</code> elementgives blind people and those with low vision (and others using assistive tech like screen readers) a description of the image and access to the same info.</li>
<li><code>&lt;table&gt;</code>s come with their own screen reader navigation: when testing with voice over, I can use <code>cmd</code> + <code>shift</code> + <code>up</code>/<code>down</code>/<code>left</code>/<code>right</code> to move the screen reader focus/cursor between the cells in both dimensions.</li>
</ul>
<p>With dataviz accessibility, however, the situation is a bit different.</p>
<p>Most visualizations are built using <code>&lt;svg&gt;</code>s. With SVG, we use elements like rectangles, circles, or paths (<code>&lt;rect&gt;</code>, <code>&lt;circle&gt;</code>, <code>&lt;path&gt;</code>) to build our visualizations. Those elements carry no semantic meaning to assistive technologies, and come with no out-of-the-box keyboard interaction. The same is true when building visualizations from <code>&lt;div&gt;</code>s and <code>&lt;span&gt;</code>s.</p>
<p>Data visualizations typically are inaccessible by default. If we don't actively curate accessibility of our charts, we will end up with visualizations that are varying levels of inaccessible.</p>
<h3>Graphical elements that carry meaning need text alternatives</h3>
<p>Let's take a look at this chart from Aftenposten:</p>
<div class="video-wrapper"><p><a href="https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/">Video in the original post</a></p><p class="transcript">Video description: Bar chart showing the shift in votes for each party compared to last elections. The category labels (logos of the parties) are displayed vertically. If a party has a negative shift, the bar is displayed on the left side, positive shifts to the right side. I'm using VoiceOver on the page, and the only items on the chart that are reachable by screen reader are the values next to the bars, but not the party names.</p></div>
<p>The only thing read out are the text elements (<code>&lt;text&gt;</code>) which contain the numbers.</p>
<p>The logos are added as an SVG element consisting only of <code>&lt;path&gt;</code>s, which by default do not contain any info for screen readers to parse. As a result, only the result numbers are announced, not the parties they correspond to.</p>
<p>This makes the entire chart inaccessible to screen reader users. It's just a sequence of unlabelled numbers.</p>
<h3>We may need to provide additional context and structure to the data to make it screen reader accessible</h3>
<p>Let's take this example is from VG.</p>
<p>Here the screen reader announces all the images and text elements (in itself this is fine), but there is no extra info about what the numbers represent, how they relate to the images, or how the parties are structured.</p>
<div class="video-wrapper"><p><a href="https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/">Video in the original post</a></p><p class="transcript">Video description: Comparison/progress chart showing how close the red coalition and blue coalition are to the 30 mandate majority. A screen reader is used to navigate between the different text elements of the chart, which are announced in the following order: left candidate picture alt text, the candidate name, party, amount of mandates on the left, the label "30 mandates", amount of mandates on the right, a list of text labels that just contain party abbreviations ("R", "MDG", "V") from left to right, right candidate picture alt text, the candidate name and party.</p></div>
<p>Visually, we have:</p>
<ul>
<li>The left / red parties, on the left side of the graph</li>
<li>The right / blue parties, on the right side of the graph</li>
<li>Name, party, and picture of the main person on either side</li>
<li>Total amount of mandates for either side, written next to the name</li>
<li>How close either side is to the 30 mandate majority</li>
<li>Underneath each side (red/blue), which parties belong to them</li>
<li>The amount of mandates for each of the parties</li>
</ul>
<img src="https://cdn.sanity.io/images/njlrbdui/production/06d70162eaa71454541a2094c4dddd6137e60f56-1804x1052.png?w=1200" alt="Comparison/progress chart showing how close the red coalition and blue coalition are to the 30 mandate majority, through a bar that's filled with red on the left, gray in the middle, and blue on the right.   There's a &quot;30 mandates&quot; text label in the middle. On either side of the bar there's the name and picture of their main candidate, the name of the main party, and the amount of mandates the coalition has. Underneath each coalition the parties that belong to it are listed, along with the amount/proportion of mandates that belong to them (1 square in their party color per mandate, grouped in colored areas with a text label on top). Underneath the chart are tickboxes for each party. On top of the chart there's a main title and a description explain the chart, a location title, and percentage of votes counted." class="small" />
<p>The screen reader announced, in this order:</p>
<ol>
<li>Image description of the candidate on the left</li>
<li>First name, last name, party of the candidate on the left</li>
<li>Mandates of the left (without label, eg. just &quot;27&quot;)</li>
<li>&quot;30 mandates&quot;</li>
<li>Mandates on the right (again without label)</li>
<li>Initials of all the parties, from left to right</li>
<li>The full name, party, image description of candidate on the right</li>
</ol>
<p>Without any of this data being structurally grouped, and without any additional labelling, this doesn't tell us the same as the visuals.</p>
<p>We're not told any info about the size of the parties or which side they belong to, and the number of mandates for the right side is not announced along side its label (the candidate name and picture).</p>
<p>Some of the following could be done to improve this:</p>
<ul>
<li>Grouping and/or connecting the candidate name, party and amount of mandates. This includes tidying up the order of the elements.<br>
<em>Eg: &quot;Raymond Johansen, AP:  28&quot;, &quot;Eirik Lae Solberg, H: 30&quot;</em></li>
<li>Grouping the parties by left/right side, and labelling each side.<br>
<em>Eg: &quot;Red block&quot; (unordered list) and &quot;R&quot; (list item), &quot;SV&quot; (list item), etc.</em></li>
<li>Adding the amount of mandates to each of the parties.<br>
_Eg: &quot;R: 4 mandates&quot;,  &quot;SV: 6 mandates&quot; _</li>
</ul>
<p>The chart is interactive, and parties can be toggled on/off to see how many mandates each side would have, and how that changes who has the majority of mandates. Those updates are communicated visually, but screen reader users also need to know:</p>
<ul>
<li>Which of those parties are toggled on/off when going through the visualization of the parties and their amount of mandates</li>
<li>What the tick boxes are meant for (a label to explain their purpose), and also that the visualization updated after (un)ticking a box</li>
</ul>
<h3>Similar charts can have different valid solutions</h3>
<p>NRK's results have a similar percentage-based visualization as VG. NRK's isn't interactive, however, and so they can take a different approach to it: turning the visualization into an image with alt text.</p>
<p>The alt text says the % of votes for the red parties, % of votes for the independent parties, and % of votes for the blue parties. This is the same as what's represented visually.</p>
<div class="video-wrapper"><p><a href="https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/">Video in the original post</a></p><p class="transcript">Video description: I'm using the screen reader to navigate between the elements on the page. There is a list of visualizations showing the percentage of votes the red block (on the left) has compared to the blue block (on the right). The charts are announced as images with alt text, like for example: "Red block: 45.8%, Independent parties: 1.7%, Blue block: 52.5%. Red block. Blue block.". They're wrapped in links, along with the name of the city and the % of votes counted.</p></div>
<p>Even though there's a small bug with it <em>(the actual &quot;red parties&quot; and &quot;blue parties&quot; are not announced, but their subtitles are)</em>, alt text like this can be sufficient for this type of chart in the way NRK used it.</p>
<p>The Aftenposten example from earlier used the same chart type and same data as NRK, but has interaction attached to it <em>(tickboxes on the bottom that filter results within the chart)</em>, and also visualizes the party names according to the amount of mandates they have. This will also lead to different screen reader solutions, since turning the chart into an image with alt text would take some of that functionality away.</p>
<h3>Not testing visually hidden labels can lead to incomprehensible data</h3>
<p>A mistake I often come across in reviews is improper labelling elements.</p>
<p>Sometimes people do indeed add screen reader alternatives, but either use the wrong properties, or add information that's incorrect or not useful.</p>
<p>Often those type of issues happen because if you don't use assistive technology yourself, you won't notice the content and behavior of visually hidden labels until you inspect the code, test the page with a screen reader, or otherwise try to assess the accessibility.</p>
<p>One of the charts where I suspect this type of testing was lacking is this distribution graph by Aftenposten.</p>
<div class="video-wrapper"><p><a href="https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/">Video in the original post</a></p><p class="transcript">Video description: The screen reader focus is moved down a list of cities. For each city, the percentage of mandates each party has is visualized, and grouped by coalition. All the cities are announced as links with the following label: "Trondheim, 100% opptalt, parti navn,  parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn".</p></div>
<p>It shows the distribution of mandates (per party, grouped by left/right coalition) for all of the major towns in Norway, all the parties were <code>aria-label</code>led by (I assume) their placeholder text: <em>&quot;Parti navn&quot;</em> aka <em>&quot;Party name&quot;</em>.</p>
<p>As a result, VoiceOver announced results like: <em>&quot;Trondheim, 100% opptalt, parti navn,  parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn, parti navn&quot;</em>.</p>
<p>One of the other things that's missing here as well is, again, the number of votes connected to each party.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/63b7678a62db70266833aa23dcfe42dd50dd5e10-1694x1160.png?w=1200" alt="How the mandates are distributed in the major cities. For each city, a horizontal list of colored bars (in the colors of the corresponding party) is shown, grouped by block/coalition (red/left or blue/right). The coalitions with the least votes have their colors dimmed. Next to each city it shows the % of votes counted, and there is a vertical line going through the middle of the chart, labelled &quot;majority&quot;, to indicate which point either side has to cross to reach a majority." class="small" />
<img src="https://cdn.sanity.io/images/njlrbdui/production/3746daa3c2adc75d9923c9b51ef764778a14e9a8-1731x859.png?w=1200" alt="Safari inspector showing the HTML structure of the chart. There's an unordered list containing an h6 and vertical separator (the majority label), and links with a href and title property set. Each link contains a list item, with several nested divs inside of it. One of the divs contains an em that has an aria-label (parti navn) set, and has the amount of mandates inside as text." class="small" />
<p>Some issues can always go past us for several reasons <em>(everyone I know in tech is overworked and tired)</em>, but to me, bugs like these potentially highlight an issue with (or a lack off) accessibility processes, because:</p>
<ul>
<li>Accessibility linters may or may not pick up on some of the issues connected to this</li>
<li>Code reviews (by team members that are accessibility-aware) increase the chance of these getting caught early</li>
<li>An accessibility focus in the content review process can discover issues with the alt text</li>
<li>Testing features with a screen reader would definitely flag these</li>
</ul>
<p>So if those exist in production, it means that either the team isn't doing some/any of the above in their process, or they do a fair share of accessibility testing, but don't get the time to actually fix the issues that were raised.</p>
<h2>Graphical elements require 3:1 contrast with the background</h2>
<p>Most of the news media did actually fine when it came to the color contrast of the text. The main body text was black on a white background (or light text on a dark background in dark mode).</p>
<p>The text elements within the data visualizations generally had sufficient (4.5:1) contrast with their background as well, although there were a few hiccups.</p>
<p>For example, Aftenposten's green and red text showing the shift between now and the last election does not have enough contrast against white. But overall, the text color contrast requirement seemed well understood.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/1fccd87396566b14af206fbd07aaabe5beba39bd-2408x1442.png?w=1200" alt="Bar chart with small green text that only has 2.59:1 contrast with the white background." class="small" />
<p>Things like bars on a bar chart, lines on a histogram, icons, and other graphical elements require a contrast ratio of at least 3:1 to make sure they're accessible to folks with low vision.</p>
<p>This was something most of the charts didn't accommodate for.</p>
<p>Aside from Valgresultat, all dashboards went for colors similar to the party's brand colors in their charts. That's good for cognitive accessibility, since people may recognize those already.</p>
<p>Some of those party colors are light, and for those NRK changed the font color for the overlaying text is changed to be at least 3:1 with the party color. That's good, and really improves the readability of those icons.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/60d3f9eb2f25ba659caa0038490ee6547fe72df5-2848x1382.png?w=1400" alt="Dark green text against light green background: 8.42:1; Dark teal against light teal: 6.91:1" class="large" />
<p>However, the same brand colors are used on the bars, which are graphical elements that require 3:1 contrast with the background. For example, SP's light green (#BBCB4D) has a color contrast of 1.79:1 against the white background, which is too low.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/5e463d7ebfd573cf24425ea9e9128e21c5090ae2-2848x1382.png?w=1400" alt="Light green bar against the white background has 1.79:1 contrast, light teal bar 2.18:1" class="large" />
<p>Additionally, all the dimmed versions of the brand colors (that visualize the numbers from last election) lack color contrast agaisn the white background.</p>
<p>The other newspapers had similar contrast issues. The bright green and yellow that Aftenposten used had less than 3:1 contrast with the white background, and VG's blue was at 2.63:1 too low to be used for both the text and chart elements.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/f6eb14b92976e541625d630b65b5597bdd3525ef-2408x1112.png?w=1200" alt="Blue text and bar chart that's 2.63:1 color contrast" class="small" />
<h2>The page itself needs to be accessible too</h2>
<p>It's great if a visualization is accessible, but if it exists within a page filled with accessibility issues, then people may not even reach the chart at all.</p>
<h3>Heading levels are important for explaining the structure and relationships of the content</h3>
<p>Using subtitles/headings on a page introduces, structures, and sometimes summarizes the content. The text sets the expectation of what you're about to read, and the styling (font-size, weight, position, etc) of the headings says something about the relationship they have to each other.</p>
<p>Semantically, this structure and relationship is communicated by using heading elements with the correct heading level (<code>&lt;h1&gt;</code>, <code>&lt;h2&gt;</code>, <code>&lt;h3&gt;</code>, etc).</p>
<p>Valgresultat used an <code>&lt;h1&gt;</code> for all of their subtitles, not just the main page title. This took away the structure for screen reader users, and announces the page title on the same level as the subtitles in the footer, for example.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/c4610e9d078e016a0cbebce72efcb9d7cae4c911-1310x680.png?w=1200" alt="Headings menu in VoiceOver showing 7 heading elements, all level 1 (h1): valgresultat, lanfsoversikt, eksport av data for landsoversikt, adresse, postadresse, lenker, kontakt" class="small" />
<p>In comparison, VG added headings to each of their sections, and the heading levels reflect the structure of the page. When browsing the headings menu in VoiceOver, I can tell that <em>&quot;Kampen om storbyene&quot;</em> (&quot;The battle for the big cities&quot;) has information for 6 different places: Oslo, Bergen, Stavanger, Trondheim, Kristiansand, and Tromsø.</p>
<img src="https://cdn.sanity.io/images/njlrbdui/production/8b7300e6ba41fc02a50deced653eb6fc88add8b2-2856x1566.png?w=1200" alt="VG's page with VoiceOver headings menu open, showing a structure with one H1, and underneath a good structure with nested H2-4s." class="small" />
<h3>Internationalization needs to be considered</h3>
<p><a href="https://valgresultat.no/valg/2023/ko">Valgresultat</a> has a language selector which lets the user switch between four different languages:</p>
<ul>
<li>English</li>
<li>Norwegian (Bokmål)</li>
<li>Norwegian (Nynorsk)</li>
<li>Northern Sami (Sámegiella)</li>
</ul>
<p>The text on the page updates to the selected language, but the language of the page never gets updated programmatically. According to the HTML <code>lang</code> code, the page is in English regardless of which language is selected.</p>
<p>Screen readers change their language and pronunciation based on the language of the content, and translation tools can base themselves on the <code>lang</code> attribute as well, so it's important that the language tag reflects the language on the page.</p>
<h2>Maps are tricky to get right, often ignored</h2>
<p>Across my client work I notice that maps are the chart type that spark the most conversation.</p>
<p>Do people want to navigate them sorted by name, continent, or value? What should the default sorting order be? Should keyboard users be able to navigate around spatially to neighboring countries? How do we visualize the data of small countries? Do we allow zoom? How does that work for keyboard users? How do we visualize borders? What are the color contrast requirements for adjacent regions?</p>
<p>All that to say: there's a lot to be considered when it comes to map accessibility. This is clear from how the different media made their maps accessible: they didn't.</p>
<h3>The election maps were lacking screen reader interaction, table alternatives, and informative text alternatives</h3>
<p>Across all the websites that used maps to visualize the election results, none provided a table alternative or direct screen reader interaction with the map.</p>
<div class="video-wrapper"><p><a href="https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/">Video in the original post</a></p><p class="transcript">Video description: A bar chart and map. The screen reader announces the text labels on the bar chart, in chronological order (but reads the letters of the party names one by one), then the zoom buttons on the map are announced, and the map itself is skipped. There is no table alternative.</p></div>
<p>VoiceOver just skipped past VG's and Aftenposten's map. The zoom buttons were announced correctly, but the actual informative content was not there.</p>
<p>NRK's map was turned into an image with alt text, but the alt text only described what type of info was visualized on the map, not the actual data. NRK also made some extra effort to summarize the graph for everyone. Underneath the map they listed the parties and in how many municipalities they were in the majority.</p>
<div class="video-wrapper"><p><a href="https://fossheim.io/writing/posts/dataviz-accessibility-review-norwegian-elections-2023/">Video in the original post</a></p><p class="transcript">Video description: A map that's announced as a figure, and a text alternative is announced. However the text just describes the purpose of the graph (it's a map of Norway with the municipalities colored in the color of the party that had the most votes there). There is no table alternative. There is a list below the map, summarizing the amount of municipalities where each party is the largest.</p></div>
<p>This in a way provides a text format of the amount of color that's observable on the map, but there is no place to view a list or table with all of the municipalities and their biggest party.</p>
<h2>Public vs. private sector?</h2>
<p>Before this I was curious how the graphs of the public vs. private sector performed. While I did feel like more emphasis had been placed on accessibility and compliance on the two sources from the public sector, all the dashboards I inspected had room for improvement, including those from the public sector.</p>
<p>Currently the Norwegian public sector has to follow <a href="https://www.uutilsynet.no/wcag-standarden/wcag-standarden/86?f%5B0%5D=t2%3A129">47 WCAG success criteria</a>, the <a href="https://www.uutilsynet.no/wcag-standarden/wcag-standarden/86?f%5B0%5D=t2%3A130">private sector</a> 35. All websites are tested had some issues against those. A couple of examples:</p>
<ul>
<li>VG's map did not have a text alternative (SC 1.1.1)</li>
<li>NRK's bar charts were lacking color contrast (SC 1.4.11)</li>
<li>VG's party-colored text was lacking color contrast (SC 1.4.3)</li>
<li>Aftenposten's positive/negative numbers were lacking text contrast (SC 1.4.3)</li>
<li>NRK's map used only color to convey information (SC 1.4.1)</li>
<li>Valgresultat's language doesn't update (SC 3.1.1)</li>
</ul>
<p>Both with the <a href="https://www.uutilsynet.no/regelverk/gjeldende-regelverk-og-krav/746">current</a> and <a href="https://online-accessibility-countdown.eu/?lang=en">upcoming</a> regulations in mind, the Norwegian news media and government definitely have some work left to do.</p>
<h2>Looking for an accessibility review, training, or help with dataviz accessibility?</h2>
<p>Are you after reading this article curious about how accessible your data visualizations are? Want to onboard your team on dataviz accessibility with a training session? Or have a chat about how to incorporate accessibility work into your organization?</p>
<p>🙋🏻 I'm an independent accessibility specialist with an offering focused on dataviz accessibility. If you're interested in hiring me for an accessibility project or are wondering how we can <a href="https://fossheim.io/work/">collaborate</a>, feel free to reach out through <a href="mailto:accessibility@fossheim.io">accessibility@fossheim.io</a>.</p>