<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Leslie Cohn-Wein&#39;s Blog</title>
  <subtitle>Writing from a Staff Frontend Engineer about Jamstack, React, CSS, and accessiblity</subtitle>
  <link href="https://leslie.dev/feed.xml" rel="self"/>
  <link href="https://leslie.dev/"/>
  <updated>2020-09-13T00:00:00Z</updated>
  <id>https://leslie.dev/</id>
  <author>
    <name>Leslie cohn-Wein</name>
    <email>leslie@cohnwein.com</email>
  </author>
  
  <entry>
    <title>On the things that matter</title>
    <link href="https://leslie.dev/posts/on-the-things-that-matter/"/>
    <updated>2020-06-12T00:00:00Z</updated>
    <id>https://leslie.dev/posts/on-the-things-that-matter/</id>
    <content type="html">&lt;p&gt;I found out at the beginning of the month that my high school boyfriend &lt;a class=&quot;text-link&quot; href=&quot;https://www.legendsfuneralhome.com/obituary/Matthew-Driver&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;Matthew Driver&lt;/a&gt; died by suicide on May 22nd.&lt;/p&gt;
&lt;p&gt;As teenagers, our relationship had grown out of our shared experiences of depression and self-harm. At an age when it’s not unusual to feel misunderstood, we found a deep connection to what felt like the darkest parts of each other.&lt;/p&gt;
&lt;p&gt;But we also had fun.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://leslie.dev/images/posts/on-the-things-that-matter/swingset.jpg&quot; alt=&quot;Matthew and Leslie on a swingset at the park&quot; /&gt;&lt;/p&gt;
&lt;p&gt;He gave me the silliest nicknames, a few of which I’m not sure I’ll ever escape. We drove around in his SUV listening to Bright Eyes, sometimes “hiding” a friend in the trunk so we could sneak one more person off campus for lunch.&lt;/p&gt;
&lt;p&gt;We shared queso at Taco Cabana and made tamales with his family and I ate the pancakes he made for me in his childhood kitchen.&lt;/p&gt;
&lt;p&gt;I dragged him to the Homecoming dance; he even smiled in some of the pictures I took, which wasn&#39;t something he normally did. We watched “The Exorcist” and “Return of the Living Dead” more times than I can count.&lt;/p&gt;
&lt;p&gt;We were both prolific on LiveJournal and commented on almost every entry the other posted. He helped me write my first line of CSS to customize the background of my journal.&lt;/p&gt;
&lt;p&gt;He made handmade cards for me with stickers and silly drawings, and I made him a scrapbook for our one year anniversary. He stumbled across it a few years ago and sent me photos; it was simultaneously painful and funny to look at.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://leslie.dev/images/posts/on-the-things-that-matter/scrapbook.jpg&quot; alt=&quot;Scrapbook page with photos from Homecoming&quot; /&gt;&lt;/p&gt;
&lt;p&gt;We emailed each other constantly, especially after he coerced me into switching from Netscape to Gmail for more storage space. When I search my inbox for his goofy old email address (rawrimazombie!), I can easily end up on page 350 “of many.”&lt;/p&gt;
&lt;p&gt;We made each other mix CDs where 75% of the songs were Bright Eyes. “Something Vague” was our favorite; it was included on every single mix.&lt;/p&gt;
&lt;p&gt;https://open.spotify.com/playlist/1GlwMfTOQzA0QtDGEbqMSi?si=qQ7v9rTQTbmSEOgvuTWsXg&lt;/p&gt;
&lt;p&gt;https://open.spotify.com/track/7eUVluJU03fnTuCcNC8ITH?si=BwpZitrxSYazIvVP7ZH2rA&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;But now I&#39;m confused.&lt;br /&gt;
Is this death really you?&lt;br /&gt;
Do these dreams have any meaning?&lt;br /&gt;
No. No, I think it&#39;s more like a ghost&lt;br /&gt;
That&#39;s been following us both.&lt;br /&gt;
Something vague that we&#39;re not seeing,&lt;br /&gt;
Something more like a feeling.&lt;br /&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;He gave me a ring. It didn&#39;t mean what you think it means, but it also meant everything. We experienced a lot of firsts together.&lt;/p&gt;
&lt;p&gt;It didn’t end well, but that’s probably true of most high school relationships. As is typical, graduation became a natural ending and simultaneous new beginning.&lt;/p&gt;
&lt;div class=&quot;separator&quot;&gt;&lt;/div&gt;
&lt;p&gt;Matthew reached back out to me in 2017 and it was like no time had passed; we started messaging back and forth every few months. I felt guilty that he was (still) mired in depression, trying to survive addiction and an abusive relationship.&lt;/p&gt;
&lt;p&gt;Everyone has their challenges, but I was in a good place: I had gotten married in 2015, moved from NYC back home to Texas, and was busy with my first remote dev job. I was perpetually scared of getting dragged back beneath the depths of depression myself, so some days it was hard to talk to him.&lt;/p&gt;
&lt;p&gt;If I’m being honest, I gave him a lot of tough love during those conversations. But he kept messaging me, and I was always there. We were still inextricably connected.&lt;/p&gt;
&lt;p&gt;The past is a strong drug.&lt;/p&gt;
&lt;p&gt;The last time we talked was a month before he died. He seemed to be doing well, at least based on what he told me: he was celebrating 30 days sober and finishing his first semester back at college.&lt;/p&gt;
&lt;p&gt;(He was studying computer science, which he&#39;d also taken in high school. I now realize Matthew&#39;s interest in CS helped spur mine; it&#39;s part of the reason I’m a software engineer. We talked a lot in those later years about what his coding career could look like.)&lt;/p&gt;
&lt;p&gt;I had told him a few months earlier that &lt;a class=&quot;text-link&quot; href=&quot;https://www.loudersound.com/features/bright-eyes-reunion-welcoming-back-the-band-who-helped-us-survive-the-2000s&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;Bright Eyes was putting out a new album&lt;/a&gt; following their nine year hiatus. Our final conversation started because he wanted to know if I’d heard their latest song.&lt;/p&gt;
&lt;p&gt;I hadn&#39;t, so I listened to it. And then I sent him this sadly hopeful Matt Hires song, which reminded me a bit of early Conor Oberst from “Fevers and Mirrors.”&lt;/p&gt;
&lt;p&gt;https://open.spotify.com/track/1AZ3kCJfnyJt5O3broFxAD?si=zMBDiyQXQ1y-bhm4saWWgA&lt;/p&gt;
&lt;p&gt;The song is about death, but also about life being what you make it.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;And oh my my, honey everybody dies&lt;br /&gt;
But you got, you got to see&lt;br /&gt;
That you can live your life walking in a straight line&lt;br /&gt;
But it&#39;s more than just A to B.&lt;br /&gt;
Maybe it&#39;ll find you lying peaceful under blankets&lt;br /&gt;
Or bleeding at the bottom of the stairs&lt;br /&gt;
Oh but it&#39;s not when or how you go&lt;br /&gt;
It&#39;s life and what you make it&lt;br /&gt;
It&#39;s the traveling, not the road that gets you there&lt;br /&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It is the last song I will ever send him.&lt;/p&gt;
&lt;div class=&quot;separator separator--alt&quot;&gt;&lt;/div&gt;
&lt;p&gt;I felt silly and self-important for crying so much the week I found out Matthew died. It was the same week the world had started reeling from the news of &lt;a class=&quot;text-link&quot; href=&quot;https://www.nytimes.com/2020/05/31/us/george-floyd-investigation.html&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;George Floyd’s murder&lt;/a&gt; at the hands of the police (during a &lt;a class=&quot;text-link&quot; href=&quot;https://covidtracking.com/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;global pandemic&lt;/a&gt;, no less).&lt;/p&gt;
&lt;p&gt;I tried to distract myself from the guilt I felt for having such a strong reaction to Matthew&#39;s death. Dying is a big deal to those who are left behind, but it felt like a very personal sidebar during a world uprising about systemic injustice, set against a backdrop of overflowing hopsitals and makeshift morgues.&lt;/p&gt;
&lt;p&gt;Matthew’s death wouldn&#39;t change my day-to-day much, if at all. He wasn’t a fixture of my life anymore.&lt;/p&gt;
&lt;p&gt;But he had been.&lt;/p&gt;
&lt;p&gt;My friend &lt;a class=&quot;text-link&quot; href=&quot;https://twitter.com/katekaput&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;Kate Kaput&lt;/a&gt; lost her high school boyfriend to suicide in 2005. She has written &lt;a class=&quot;text-link&quot; href=&quot;https://www.greatestescapist.com/search?q=dave&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;about Dave&lt;/a&gt; a lot since then, and &lt;a class=&quot;text-link&quot; href=&quot;https://www.greatestescapist.com/2020/02/second-thoughts-paper-hearts.html&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;her words&lt;/a&gt; have helped me get through the weeks:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;To remember love lost, to honor a life lost, to reflect &lt;strong&gt;on the ways that someone&#39;s life &amp;amp; death changed your fundamental existence&lt;/strong&gt;... that&#39;s not weird. That is very, very normal.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;These words gave me permission to grieve.&lt;/p&gt;
&lt;p&gt;These words helped me realize that it’s okay to talk about him, to write about him, to share that writing. I&#39;m doing this because I &lt;em&gt;need&lt;/em&gt; you to know he lived, and that he mattered.&lt;/p&gt;
&lt;p&gt;To remember who he was at 15 and 16 and 17 and 18 and the impact his life (and now death) has had on mine, then and now.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://leslie.dev/images/posts/on-the-things-that-matter/matthew.jpg&quot; alt=&quot;Matthew, smiling and lying upside down on my bed&quot; /&gt;&lt;/p&gt;
&lt;p&gt;Kate&#39;s words have also reminded me what actually matters at the end of the day. Or at the end of a life.&lt;/p&gt;
&lt;p&gt;For me, right now, it’s about being open and honest about the impact of suicide. It&#39;s about asking for help when I need it, and moving past the shame of feeling so much or wanting to share it. It’s about remembering Matthew and finding ways I can &lt;a class=&quot;text-link&quot; href=&quot;https://www.jedfoundation.org/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;support others&lt;/a&gt; who struggle with mental illness.&lt;/p&gt;
&lt;p&gt;It&#39;s about challenging myself to engage in the fight against injustice that is so apparent in our world, even when I&#39;ve been complicit in it, and even when it&#39;s hard. Especially when it&#39;s hard.&lt;/p&gt;
&lt;p&gt;It’s also about allowing myself - forcing myself, even - to take the time and space to feel each painful feeling as it comes up. Because I have to. Because there isn&#39;t another choice.&lt;/p&gt;
&lt;p&gt;When staring down the barrel of what feels like insurmountable anger and pain and despair, it all seems to come down to this: knowing (and trusting) that we are not alone. Even when it sure as hell feels like it.&lt;/p&gt;
&lt;p&gt;https://open.spotify.com/track/2Z8nmDARYuDDfsIylkhZT2?si=cl0OmQCtTy63RU7xyqoX2A&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Well, I guess that it&#39;s typical&lt;br /&gt;
To cling to memories you&#39;ll never get back again&lt;br /&gt;
And to sort through old photographs&lt;br /&gt;
Of a summer long ago&lt;br /&gt;
Or a friend that you used to know&lt;br /&gt;
And there below his frozen face&lt;br /&gt;
You wrote the name and that ancient date&lt;br /&gt;
And you can&#39;t believe that he&#39;s really gone&lt;br /&gt;
When all that&#39;s left is a fucking song&lt;br /&gt;
And I&#39;m sorry about the phone call and waking you&lt;br /&gt;
I know that it is late&lt;br /&gt;
But thank you for talking, because I needed to&lt;br /&gt;
Some things just can&#39;t wait&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Posted in memory of Matthew Glenn Driver&lt;br /&gt;
&lt;em&gt;September 13, 1987 - May 22, 2020&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;https://open.spotify.com/track/2na2paKLoPieSDyIcfj29u?si=0l1v2yt7Qa6Za3jWzhdXGg&lt;/p&gt;
&lt;p&gt;If you are struggling with thoughts of suicide, please reach out. &lt;strong&gt;In the U.S., help is available 24/7 by calling the National Suicide Prevention Lifeline at 1-800-273-8255.&lt;/strong&gt;&lt;/p&gt;
</content>
  </entry>
  
  <entry>
    <title>Writing semantic HTML even when you don&#39;t know any better: progress vs meter</title>
    <link href="https://leslie.dev/posts/writing-semantic-html-even-when-you-dont-know-any-better/"/>
    <updated>2020-09-13T00:00:00Z</updated>
    <id>https://leslie.dev/posts/writing-semantic-html-even-when-you-dont-know-any-better/</id>
    <content type="html">&lt;p&gt;There are something like &lt;a class=&quot;text-link&quot; href=&quot;http://html5doctor.com/element-index/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;110 unique tags in HTML5&lt;/a&gt;. Not exactly the easiest list to memorize, am I right? (Even for me, and I&#39;m the kind of person whose &lt;a class=&quot;text-link&quot; href=&quot;https://www.smashingmagazine.com/2015/05/desktop-wallpaper-calendars-june-2015/#periodic-table-of-html5-elements&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;desktop wallpaper&lt;/a&gt; shows a periodic table of HTML5 elements.)&lt;/p&gt;
&lt;p&gt;So, how can you figure out which &lt;a class=&quot;text-link&quot; href=&quot;https://www.freecodecamp.org/news/semantic-html5-elements/#why-use-semantic-elements&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;semantic element&lt;/a&gt; to use when you don&#39;t even know what&#39;s available to you? Let&#39;s take a look at a real-world example.&lt;/p&gt;
&lt;h2&gt;Define the component requirements&lt;/h2&gt;
&lt;p&gt;The design team at Netlify recently passed off a new Figma component for implementation in React. Looks pretty straightforward to me!&lt;/p&gt;
&lt;p class=&quot;post__half&quot;&gt;
&lt;img src=&quot;https://leslie.dev/images/posts/writing-semantic-html-even-when-you-dont-know-any-better/metric-widget.png&quot; alt=&quot;Screenshot: UI widget with a status bar, showing $218 of $400 spent on groceries&quot; /&gt;
&lt;/p&gt;
&lt;p&gt;I started by making a quick list of the requirements. The component should have:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;the ability to act like a link if an &lt;code&gt;href&lt;/code&gt; is passed&lt;/li&gt;
&lt;li&gt;a status bar to indicate current usage, which looked a lot like the &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; element to me&lt;/li&gt;
&lt;li&gt;a numeric &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt; limit&lt;/li&gt;
&lt;li&gt;the ability to handle different units (such as money, file size, etc.)&lt;/li&gt;
&lt;li&gt;styles that match the mockup, including hover and focus states&lt;/li&gt;
&lt;/ul&gt;
&lt;div class=&quot;separator&quot;&gt;&lt;/div&gt;
&lt;h2&gt;Ask: &amp;quot;Does my markup make sense in plain English?&amp;quot;&lt;/h2&gt;
&lt;p&gt;Knowing the requirements can help us translate the component into code.&lt;/p&gt;
&lt;p&gt;Narrowing in on the link and status bar reqs, I wrote three lines of markup:&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://leslie.dev&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;progress&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;218&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;400&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;54%&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;progress&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;progress value=&quot;218&quot; max=&quot;400&quot;&gt;54%&lt;/progress&gt;&lt;/p&gt;
&lt;p&gt;Why did I use &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt;? First, because I knew it existed, and second, because the default styles for &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; look &lt;em&gt;almost exactly like&lt;/em&gt; the design mockup I was given.&lt;/p&gt;
&lt;p&gt;But when I write new HTML, I try to ask myself: &amp;quot;Does this markup make sense in plain English?&amp;quot; This is, after all, the essence of what the word &lt;strong&gt;semantic&lt;/strong&gt; means: the &amp;quot;correct interpretation of the meaning of a word&amp;quot; (source: &lt;a class=&quot;text-link&quot; href=&quot;https://www.dictionary.com/browse/semantics&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;dictionary.com&lt;/a&gt;). In most cases, we should be able to &amp;quot;translate&amp;quot; our markup into an intelligible sentence.&lt;/p&gt;
&lt;p&gt;So: &amp;quot;$218 used is progress toward a $400 budget.&amp;quot;&lt;/p&gt;
&lt;p&gt;Not quite right, huh? It would probably make more sense to call this &amp;quot;money usage,&amp;quot; not &amp;quot;money progress.&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rewording markup in plain English can help make semantic discrepancies more obvious.&lt;/strong&gt; Checking &lt;a class=&quot;text-link&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;the MDN docs&lt;/a&gt; also provides some clarity:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The HTML &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; element displays an indicator showing the completion progress of a task&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;We&#39;re definitely not showing the completion progress of a task here. Case closed! We shouldn&#39;t use &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; for this component.&lt;/p&gt;
&lt;div class=&quot;separator separator--alt&quot;&gt;&lt;/div&gt;
&lt;h2&gt;Follow the docs&lt;/h2&gt;
&lt;p&gt;So, what element should we use instead?&lt;/p&gt;
&lt;p&gt;Lucky for us, MDN is great at giving hints. If we keep reading the docs about &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt;, we&#39;ll come across a note under &lt;a class=&quot;text-link&quot; href=&quot;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/progress#Attrributes&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;the &amp;quot;Attributes&amp;quot; heading&lt;/a&gt; that mentions the related &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; element:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The HTML &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; element represents either a scalar value within a known range or a fractional value&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;To steal a catchphrase from former Netlify designer &lt;a class=&quot;text-link&quot; href=&quot;https://rafa.design/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;Rafa Conde&lt;/a&gt;: 🛎️ Ding!&lt;/p&gt;
&lt;p&gt;We want to communicate that $218 was used in relation to a maximum budget of $400. This is the element we want!&lt;/p&gt;
&lt;div class=&quot;separator&quot;&gt;&lt;/div&gt;
&lt;h2&gt;Keep learning: &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; in context&lt;/h2&gt;
&lt;p&gt;If it seems like we had to do a lot of work in order to make a one-word change in the final markup, you wouldn&#39;t be wrong.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://leslie.dev&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meter&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;218&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;400&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;$218/$400&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;meter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;meter value=&quot;218&quot; max=&quot;400&quot;&gt;$218/$400&lt;/meter&gt;&lt;/p&gt;
&lt;p&gt;So why put all this effort in?&lt;/p&gt;
&lt;p&gt;Well, besides the obvious &lt;a class=&quot;text-link&quot; href=&quot;https://24ways.org/2017/accessibility-through-semantic-html/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;accessibility wins&lt;/a&gt;, &lt;strong&gt;using the proper semantic element can give us more functionality for free&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;In this case, &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; has some special attributes baked in that &lt;code&gt;&amp;lt;progress&amp;gt;&lt;/code&gt; does not. Along with  &lt;code&gt;min&lt;/code&gt; and &lt;code&gt;max&lt;/code&gt;, &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; also supports &lt;code&gt;low&lt;/code&gt; , &lt;code&gt;high&lt;/code&gt;, and &lt;code&gt;optimum&lt;/code&gt;. These attributes let us specify the bounds of the measured range, and we can also use them to hook into pseudo classes for custom styling.&lt;/p&gt;
&lt;p&gt;This means we can control the color of our status bar based on the value!&lt;/p&gt;
&lt;p&gt;So now we can style the bar to be green when it&#39;s in the lower bound, blue in the optimum or expected range, and yellow as we near the limit of our budget.&lt;/p&gt;
&lt;pre class=&quot;language-html&quot;&gt;&lt;code class=&quot;language-html&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;a&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;href&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;http://leslie.dev&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;	&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;meter&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;value&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;370&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;max&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;400&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;high&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;300&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;optimum&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;200&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;$370/$400&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;meter&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;/&lt;/span&gt;a&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;meter value=&quot;370&quot; max=&quot;400&quot; high=&quot;300&quot; optimum=&quot;200&quot;&gt;$370/$400&lt;/meter&gt;&lt;/p&gt;
&lt;p&gt;CSS Tricks offers more &lt;a class=&quot;text-link&quot; href=&quot;https://css-tricks.com/html5-meter-element/&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;tips for styling the &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; element&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If you&#39;re interested in how I styled this particular component to match the mockup, &lt;a class=&quot;text-link&quot; href=&quot;https://twitter.com/intent/tweet?url=http%3A%2F%2Fleslie.dev%2Fposts%2Fwriting-semantic-html-even-when-you-dont-know-any-better%2F&amp;via=lesliecdubs&amp;text=Hey%20Leslie%2C%20I%20wanna%20know%20how%20you%20styled%20the%20%60%3Cmeter%3E%60%20element%21&quot; target=&quot;_blank&quot; rel=&quot;noopener nofollow&quot;&gt;let me know on Twitter&lt;/a&gt; and maybe I&#39;ll draft a follow-up (spoiler: applying selective rounded corners to the different states of &lt;code&gt;&amp;lt;meter&amp;gt;&lt;/code&gt; is a trip!).&lt;/p&gt;
&lt;div class=&quot;separator separator--alt&quot;&gt;&lt;/div&gt;
&lt;h2&gt;TLDR: Semantics matter&lt;/h2&gt;
&lt;p&gt;When writing new markup:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Ask: &amp;quot;Does my markup make sense in plain English?&amp;quot; Rewording markup in plain English can help make semantic discrepancies more obvious.&lt;/li&gt;
&lt;li&gt;Read the MDN docs to confirm your usage&lt;/li&gt;
&lt;li&gt;Leverage baked-in functionality for free&lt;/li&gt;
&lt;/ul&gt;
</content>
  </entry>
</feed>