We broke the internet so here’s how to start fixing it

16.5.2019

Joonas Kallunki

Joonas Kallunki

Joonas is a visually minded front-end developer constantly pursuing for new ways to reach contentment in application experience. He is interested about interactions between technology and humanity overall. His developer life is adjusted with a lots of music, exercising within nature and precious family moments. "The CSS dude can handle this".

A bit about Technical debt of the HTML standard

HTML was written by Tim Berners-Lee originally in 1993 but was updated to version 4.01 in 1999 (the most used version) and also based on that the XHML1.0 standard was released. I remember first wondering what’s the meaning for <div>-tag introduced in HTML3.2 after 1997.W3C (World Wide Web Consortium) abandoned XHTML after version 2.0, but used all the functions that XHTML supports when designing HTML5. Usually, you need to know what features browsers support like with CSS3 and JavaScript ES6 and the same goes with HTML5, but luckily semantic elements of HTML5 have been widely supported for many years now.

Use semantic tags to communicate meaning instead of for presentation purposes

HTML elements are chosen by what the content is – not by their appearance. Simply put, HTML semantics are HTML tags that have a meaning.

Common tags that don’t include semantic meaning in HTML are <div> and <span>. That doesn’t mean that they couldn’t have some semantic meaning in visual user experience or cognitive accessibility.

When we think about creating a webpage or a webapp we should be thinking about communicating. The visual appearance is a separately defined part of the result. A semantic HTML-page is providing meaningful information to the browser and other clients like screen readers, search engines and developers analyzing the source. So semantics go far beyond how the content looks on a page. The browser agent creates the basic visuals based on the semantics. It is common in today’s real world that the visual design needs to be something completely different from what the browsers default to. We can use technical languages, tools and libraries to get the desired visual styles. We can also just reset them to always behave in the same way. Don’t use HTML-tags in an HTML document (or layout and view of a webapp) just for their common display properties. Remember to separate that from your ideology and just think first about the semantic structure.

Prevent the most common mistakes – use CSS to modify visual appearance.

Don’t use <h1> – <h6> -elements for text sizing.

Dividing content with <div>’s says nothing about the structure or why contents are in separate containers.

Only <li> -tags are allowed to be the direct descendants (rendered content) of <ul> or <ol>.

NOTE:
Authors are strongly encouraged to view the div element as an element of last resort, for when no other element is suitable. Use of more appropriate elements instead of the div element leads to better accessibility for readers and easier maintainability for authors.
— https://www.w3.org/TR/html5/grouping-content.html#the-div-element

It is worth mentioning that you cannot escape understanding the basics by using libraries and frameworks. Even Semantic-UI – advertised as using concise HTML – still has notable ongoing issues with accessibility. Wouldn’t you think it is also misleading to be called a fullstack developer or a web developer if you don’t know how to create a basic HTML document?

The key to Accessibility

The first key to accessibility – and even to user experience for people with disabilities – is learning to use semantics.

As a developer, you should be more focused on writing semantic HTML documents – not CSS (and creating a proper Design System so the developers can just stop writing custom CSS). Semantic HTML improves the readability of code – also closing tags tell you what they are closing. Understanding a new codebase can be easier if it uses the standards.

Maybe I should make sure that others can also see how I think of the content.