A place to cache linked articles (think custom and personal wayback machine)
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

pirms 10 mēnešiem
pirms 9 mēnešiem
pirms 9 mēnešiem
pirms 10 mēnešiem
1234567891011121314151617181920212223242526
  1. title: The UX of HTML ⚒ Nerd
  2. url: https://vasilis.nl/nerd/the-ux-of-html/
  3. hash_url: e5056f8e0e6acf87c5777ba5b3a2ba92
  4. archive_date: 2024-01-08
  5. og_image:
  6. description:
  7. favicon: https://vasilis.nl/favicon.ico
  8. language: en_US
  9. <p>Recently when I gave a coding assignment — an art directed web page about a font — a student asked: does it have to be <em>semantic and shit?</em> The whole class looked up, curious about the answer — <em>please let it be no!</em> I answered that no, it doesn’t have to be semantic and shit, but it does have to be well designed and the user experience should be well considered. Relieved, all of my students agreed. They do care about a good user experience.</p>
  10. <p><span id="more-2095"></span></p>
  11. <p>The joke here is, of course, that a well considered user experience starts with well considered <abbr title="HyperText Markup Language">HTML</abbr>.</p>
  12. <p>Somehow my students are allergic to semantics and shit. And they’re not alone. If you look at 99% of all websites in the wild, everybody who worked on them seems to be allergic to semantics and shit. On most websites heading levels are just random numbers, loosely based on font-size. Form fields have no labels. Links and buttons are divs. It’s really pretty bad. So it’s not just my students, the whole industry doesn’t understand semantics and shit.</p>
  13. <p>Recently I decided to stop using the word <em>semantics</em>. Instead I talk about the <abbr title="User eXperience">UX</abbr> of <abbr>HTML</abbr>. And all of a sudden my students are not allergic to <abbr>HTML</abbr> anymore but really interested. Instead of explaining the meaning of a certain element, I show them <em>what it does</em>. So we look at <em>what happens</em> when you add a label to an input: The input and the label now form a pair. You can now click on the label to interact with a checkbox. The label will be read out loud when you focus on an input with a screenreader. When you hover over a <em>label,</em> the hover state of the connected <em>input</em> is shown. My students <em>love</em> stuff like that. They care about <abbr>UX</abbr>. </p>
  14. <p>I show them that <span>a span with an onclick-event</span> might seem to be behaving like a link, but that there are many layers of <abbr>UX</abbr> missing when you look a bit closer: right-click on <span>this span</span>, and a generic context menu opens up. When on the other hand you right-click on <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a">a proper link like this one</a> a specialised context menu opens, with all kinds of options that are specific to a link. And I show them that proper links show up when you ask your screen reader to list all the links on a page, yet spans with an onclick-event don’t. Moreover, a span doesn’t receive focus when you tab to it. And so on. My students see this and they get it. And they love the fact that by being lazy they get much more result.</p>
  15. <p>So when I teach about <abbr>HTML</abbr> I always start with the elements that are obviously interactive. I show them the multitude of <abbr>UX</abbr> layers of a link, I show them the layers and layers of <abbr>UX</abbr> that are added to a well considered form. I show them what happens on a phone when you use an input with a default text type instead of the proper type of email. They <em>get</em> this, and they want to know more. So I show them more. I show them the <code>required</code> attribute which makes it possible to validate not only form fields, but also fieldsets and forms. They <em>love</em> this stuff. </p>
  16. <p>Then I go on and show the <code>details</code> element with a <code>summary</code>. Whoah! No JavaScript! </p>
  17. <p>These interactive things are the most important parts of <abbr>HTML</abbr>. These are the things that truly break or make a site. If you don’t use these elements properly, many people are actively excluded and the <abbr>UX</abbr> degrades in many ways. The interactive elements are what makes the web the web.</p>
  18. <h2 id="theoldfocusonsemantics">The old focus on semantics</h2>
  19. <p>Every time I come home from a web conference I hang the lanyard with the badge on a doorknob. There are at least 35 lanyards there. The oldest is more than fifteen years old, the newest just a few months. On most of these conferences there was someone telling us about the importance of using proper <em>semantic <abbr>HTML</abbr></em>. And they <em>all</em> talked about the importance of heading levels. So for <em>at least</em> 15 years we’ve been telling the web design and web development community that heading levels are very important. Yet after all these years, and after all these conferences <a href="https://webaim.org/projects/million/#headings">there are almost no websites that do it right</a>. </p>
  20. <p>Later, when <abbr>HTML</abbr>5 was introduced the talks about semantics were still mostly about creating a proper document outline, but this time with sectioning elements in combination with headings. Unfortunately this idea was never properly implemented by browsers. And it turned out that these sectioning elements are very hard to understand. For years I’ve tried to explain the difference between a section and an article, and almost nobody gets it. And of course they don’t, because it’s <a href="https://www.smashingmagazine.com/2022/07/article-section-elements-accessibility/">very, very complicated theory</a>. And above all: There’s no clear <abbr>UX</abbr> feature to point at. The user experience doesn’t change dramatically if you use a section instead of an article. It’s <em>mostly</em> theoretical. So nowadays, next to <em>divitis</em>, we also have <em><a href="https://www.reddit.com/r/web_design/comments/1it5aa/is_sectionitis_the_new_divitis/">sectionitis</a>.</em> </p>
  21. <p>Understanding how heading levels work is hard. And understanding how sectioning elements work is really hard. And explaining these things is even harder. What’s the use for <a href="https://www.w3.org/TR/HTML-design-principles/#priority-of-constituencies">theoretical purity</a> if the end result is the same?</p>
  22. <p>Yes, I know that some sectioning elements actually have some <abbr>UX</abbr> attached to it. But not that much <abbr>UX</abbr> if you compare it to the real interactive elements. Not getting your heading levels right is not at all as destructive as using divs instead of links. </p>
  23. <p>Now, I’m not saying that we should stop teaching people about heading levels and sections. We shouldn’t. Heading levels and sections do things as well. But we should think about <em>when</em> we teach these more complicated and subtle parts of <abbr>HTML</abbr>. First we need to get people exited about <abbr>HTML</abbr> by showing all the free yet complex layers of <abbr>UX</abbr> you get when you use the interactive elements properly. And then, when they do understand the interactive elements, when they’re really excited and they ask for more, show them the more obscure <abbr>UX</abbr> patterns. You need a good idea of what <abbr>UX</abbr> <em>is</em> before you can understand things like <a href="https://webaim.org/projects/screenreadersurvey9/#finding">the option to nagivate through the headings on the page</a> with a screen reader. Without an idea of what <abbr>UX</abbr> means you cannot understand what landmarks do. First start with the obvious, then show the details.</p>
  24. <p>I am very much looking forward to 15 more years of web conferences and publications. I look forward to seeing inspiring talks about the <abbr>UX</abbr> of <abbr>HTML</abbr>. Talks about the incredible radio button and its wonderful <em>indeterminate</em> state! Talks about validating forms in a friendly way with just <abbr>HTML</abbr> and some clever <abbr title="Cascading StyleSheets">CSS</abbr>. Talks about the different context menus that appear on different elements. In other words, talks about what <abbr>HTML</abbr> <em>does</em>, and much less about what it <em>means in theory</em>. Let’s talk about user experience, and let’s stop talking about semantics and shit.</p>
  25. <p><em>This article was also posted <a href="https://www.htmhell.dev/adventcalendar/2023/1/">on the 2023 HTMHell advent calendar</a>.</em></p>