Unlocking Accessibility: Frontend Developers Discuss Semantic HTML and Accessible Code

The digital landscape of the United Kingdom’s public sector is undergoing a rigorous transformation, driven by the dual imperatives of legal compliance and social equity. In the latest installment of the "Unlocking Accessibility" series, the Government Digital Service (GDS) convened a panel of lead and senior frontend developers from across the civil service to dissect the technical foundations of inclusive web design. This discussion comes at a critical juncture as the UK continues to enforce the Public Sector Bodies (Websites and Mobile Applications) Accessibility Regulations 2018, which mandate that all public sector digital touchpoints meet the Web Content Accessibility Guidelines (WCAG) 2.2 Level AA standards.

The Strategic Importance of Semantic HTML

At the core of the discussion was the concept of semantic HTML—the practice of using web markup that conveys meaning rather than just presentation. Dilwoar Hussain, Lead Frontend Developer at the Ministry of Housing, Communities and Local Government (MHCLG), characterized HTML as the "building blocks" of the internet. He noted a fundamental distinction between generic elements, such as <div> and <span>, and specific elements like <nav>, <button>, and <img style="max-width:100%;height:auto;">.

The technical consensus among the experts is that semantic HTML serves as the primary interface for assistive technologies. When a developer uses a <button> element, the browser automatically grants it keyboard focusability and communicates its role to screen readers. If a developer instead uses a <div> styled to look like a button, they must manually re-create these functionalities using JavaScript and ARIA (Accessible Rich Internet Applications) attributes—a process that is prone to error and fragility.

James Gordon, Senior Frontend Developer at the Department for Work and Pensions (DWP), highlighted a common pitfall in modern web development: the "JavaScript hangover." This occurs when developers use complex scripts to mimic basic HTML behaviors, such as turning an image into a link via a click event. "To most users, it works fine," Gordon observed, "but to a screen reader, it’s just an image." By adhering to semantic standards, developers ensure that the underlying code is interpreted correctly by a diverse array of assistive tools, from braille displays to voice control software.

Data and Context: The Scale of Digital Exclusion

The push for semantic integrity is not merely a technical preference but a response to significant demographic data. According to the Department for Work and Pensions’ latest disability prevalence estimates, approximately 16 million people in the UK live with a disability—roughly 24% of the population. Digital exclusion remains a persistent threat; data from the Office for National Statistics (ONS) suggests that disabled adults are statistically less likely to have used the internet recently compared to non-disabled adults.

For the UK government, ensuring that digital services—ranging from Universal Credit applications to NHS appointment bookings—are accessible is a matter of constitutional duty. The financial implications are also substantial. The "Purple Pound"—the spending power of disabled people and their families—is estimated at £274 billion per year in the UK. Inaccessible websites lead to "click-away" losses, where users abandon services that do not accommodate their needs.

A Chronology of Accessibility Standards

The evolution of these standards follows a clear timeline of technological and legislative milestones:

  1. 1999: The first Web Content Accessibility Guidelines (WCAG 1.0) were published, focusing primarily on HTML.
  2. 2008: WCAG 2.0 was released, introducing the four principles of accessibility: Perceivable, Operable, Understandable, and Robust (POUR).
  3. 2014: HTML5 reached "Recommendation" status by the W3C, introducing a wealth of new semantic tags like <main>, <article>, and <section> that simplified accessible structuring.
  4. 2018: The UK passed the Public Sector Bodies Accessibility Regulations, giving legal teeth to WCAG 2.1 requirements.
  5. 2023-2024: The transition to WCAG 2.2 began, adding new criteria focused on cognitive disabilities and mobile interface interactions.

Proactive Development: Shifting Left on Accessibility

A recurring theme among the developers was the "shift left" philosophy—the practice of integrating accessibility at the earliest stages of the software development life cycle (SDLC). Michael Cheung, Senior Front-end Developer at NHS England, emphasized that semantic HTML provides "accessibility for free," reducing the need for expensive remediation later in the project.

To maintain consistency, government departments increasingly rely on established design systems. The GOV.UK Design System and the NHS Design System provide pre-tested, accessible components that have undergone rigorous user research with people who use assistive technologies. Holly Blues, a Frontend Developer at DWP Digital, noted that this collaborative approach involves everyone from Product Owners to Quality Assurance testers. "This helps to keep accessibility at the forefront of our processes," Blues stated, adding that the team scrutinizes features that might traditionally rely on heavy client-side JavaScript, such as complex filters, to find more accessible alternatives.

Unlocking Accessibility: Frontend developers discuss semantic HTML and accessible code

Managing Dynamic and Interactive Elements

The most significant technical challenges often arise with dynamic content, such as modals, carousels, and accordions. These elements change state without a page reload, which can disorient users who cannot see the visual updates.

Dilwoar Hussain pointed to the use of ARIA attributes like aria-expanded and aria-controls as essential tools for managing state in collapsible elements. By toggling aria-expanded="true" or "false", developers provide screen reader users with immediate feedback on whether a section is open or closed. Furthermore, Hussain advocated for "progressive enhancement," a strategy where the core content is accessible via basic HTML, and interactive features are layered on as enhancements. This ensures that if JavaScript fails to load or is disabled, the user can still access the information.

David Biddle, a Frontend Developer at GDS, highlighted the importance of focus management. For interactive elements like modals (often implemented using the newer <dialog> element), it is crucial that the "keyboard focus" is trapped within the modal while it is active, preventing the user from accidentally navigating to the background page content. This prevents what is known as a "keyboard trap" or "focus loss," both of which are common barriers to entry for motor-impaired users.

The Role of Manual Testing and In-House Labs

While automated tools and plugins are useful for catching low-hanging fruit—such as missing alt text or poor color contrast—the developers agreed that they are no substitute for manual testing. Michael Cheung detailed the use of NHS England’s "Accessibility Lab," a dedicated facility equipped with various devices and assistive technologies. Manual testing allows developers to experience their code through the "Accessibility Tree"—the internal representation of the web page that browsers provide to screen readers.

James Gordon reinforced the necessity of "prodigious" manual testing across different technologies. He argued that the only way to verify that an interface truly works is to navigate it using only a keyboard or by listening to the output of a screen reader like NVDA (NonVisual Desktop Access) or JAWS (Job Access With Speech).

Broader Implications and Analysis

The insights shared by these developers suggest a maturing of the web development profession. Accessibility is no longer viewed as a "nice-to-have" feature or a post-launch checklist item; it is being treated as a fundamental requirement of technical excellence.

The implications of this shift are manifold:

  • Search Engine Optimization (SEO): There is a significant overlap between semantic HTML and SEO. Search engine crawlers use the same semantic cues as screen readers to index content, meaning accessible sites often rank higher in search results.
  • Maintenance and Scalability: Codebases built on semantic foundations are generally easier to maintain. Standard HTML elements behave predictably across different browsers and devices, reducing the "technical debt" associated with custom-built, non-standard components.
  • Future-Proofing: As new devices emerge—including smart watches, voice assistants, and augmented reality glasses—semantic code provides a robust structure that these new technologies can parse effectively.

Conclusion: A Commitment to Universal Design

The "Unlocking Accessibility" series underscores the UK government’s commitment to "Universal Design"—the concept of creating products that are usable by all people, to the greatest extent possible, without the need for adaptation. By prioritizing semantic HTML and proactive testing, frontend developers in the public sector are setting a global benchmark for digital inclusivity.

As the digital world becomes increasingly complex, the advice from these experts remains grounded in simplicity: use the right tool for the job, test with real users, and never treat accessibility as an afterthought. For the 16 million people in the UK with disabilities, these technical decisions are not just about code—they are about the right to access essential services with dignity and independence.

Leave a Reply

Your email address will not be published. Required fields are marked *