<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Html on Brandon Pugh&#39;s Blog</title>
    <link>https://www.brandonpugh.com/tags/html/</link>
    <description>Recent content in Html on Brandon Pugh&#39;s Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <lastBuildDate>Sun, 31 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.brandonpugh.com/tags/html/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Alerts, Callouts, and Admonitions</title>
      <link>https://www.brandonpugh.com/garden/alerts-callouts-admonitions/</link>
      <pubDate>Sun, 31 May 2026 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/garden/alerts-callouts-admonitions/</guid>
      <description>&lt;p&gt;What my site currently supports:&lt;/p&gt;
&lt;blockquote class=&#34;alert alert-note&#34;&gt;
  &lt;p class=&#34;alert-heading&#34;&gt;
    &lt;span aria-hidden=&#34;true&#34;&gt;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; viewBox=&#34;0 0 16 16&#34; width=&#34;16&#34; height=&#34;16&#34;&gt;&lt;path d=&#34;M0 8a8 8 0 1 1 16 0A8 8 0 0 1 0 8Zm8-6.5a6.5 6.5 0 1 0 0 13 6.5 6.5 0 0 0 0-13ZM6.5 7.75A.75.75 0 0 1 7.25 7h1a.75.75 0 0 1 .75.75v2.75h.25a.75.75 0 0 1 0 1.5h-2a.75.75 0 0 1 0-1.5h.25v-2h-.25a.75.75 0 0 1-.75-.75ZM8 6a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;
    &lt;em&gt;&lt;span&gt;Note&lt;/span&gt;&lt;/em&gt;
  &lt;/p&gt;
  &lt;p&gt;Highlights information that users should take into account, even when skimming.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&#34;alert alert-tip&#34;&gt;
  &lt;p class=&#34;alert-heading&#34;&gt;
    &lt;span aria-hidden=&#34;true&#34;&gt;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; viewBox=&#34;0 0 16 16&#34; width=&#34;16&#34; height=&#34;16&#34;&gt;&lt;path d=&#34;M8 1.5c-2.363 0-4 1.69-4 3.75 0 .984.424 1.625.984 2.304l.214.253c.223.264.47.556.673.848.284.411.537.896.621 1.49a.75.75 0 0 1-1.484.211c-.04-.282-.163-.547-.37-.847a8.456 8.456 0 0 0-.542-.68c-.084-.1-.173-.205-.268-.32C3.201 7.75 2.5 6.766 2.5 5.25 2.5 2.31 4.863 0 8 0s5.5 2.31 5.5 5.25c0 1.516-.701 2.5-1.328 3.259-.095.115-.184.22-.268.319-.207.245-.383.453-.541.681-.208.3-.33.565-.37.847a.751.751 0 0 1-1.485-.212c.084-.593.337-1.078.621-1.489.203-.292.45-.584.673-.848.075-.088.147-.173.213-.253.561-.679.985-1.32.985-2.304 0-2.06-1.637-3.75-4-3.75ZM5.75 12h4.5a.75.75 0 0 1 0 1.5h-4.5a.75.75 0 0 1 0-1.5ZM6 15.25a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 1 0 1.5h-2.5a.75.75 0 0 1-.75-.75Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;
    &lt;em&gt;&lt;span&gt;Tip&lt;/span&gt;&lt;/em&gt;
  &lt;/p&gt;
  &lt;p&gt;Optional information to help a user be more successful.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&#34;alert alert-important&#34;&gt;
  &lt;p class=&#34;alert-heading&#34;&gt;
    &lt;span aria-hidden=&#34;true&#34;&gt;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; viewBox=&#34;0 0 16 16&#34; width=&#34;16&#34; height=&#34;16&#34;&gt;&lt;path d=&#34;M0 1.75C0 .784.784 0 1.75 0h12.5C15.216 0 16 .784 16 1.75v9.5A1.75 1.75 0 0 1 14.25 13H8.06l-2.573 2.573A1.458 1.458 0 0 1 3 14.543V13H1.75A1.75 1.75 0 0 1 0 11.25Zm1.75-.25a.25.25 0 0 0-.25.25v9.5c0 .138.112.25.25.25h2a.75.75 0 0 1 .75.75v2.19l2.72-2.72a.749.749 0 0 1 .53-.22h6.5a.25.25 0 0 0 .25-.25v-9.5a.25.25 0 0 0-.25-.25Zm7 2.25v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 9a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;
    &lt;em&gt;&lt;span&gt;Important&lt;/span&gt;&lt;/em&gt;
  &lt;/p&gt;
  &lt;p&gt;Crucial information necessary for users to succeed.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&#34;alert alert-warning&#34;&gt;
  &lt;p class=&#34;alert-heading&#34;&gt;
    &lt;span aria-hidden=&#34;true&#34;&gt;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; viewBox=&#34;0 0 16 16&#34; width=&#34;16&#34; height=&#34;16&#34;&gt;&lt;path d=&#34;M6.457 1.047c.659-1.234 2.427-1.234 3.086 0l6.082 11.378A1.75 1.75 0 0 1 14.082 15H1.918a1.75 1.75 0 0 1-1.543-2.575Zm1.763.707a.25.25 0 0 0-.44 0L1.698 13.132a.25.25 0 0 0 .22.368h12.164a.25.25 0 0 0 .22-.368Zm.53 3.996v2.5a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 1 1.5 0ZM9 11a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;
    &lt;em&gt;&lt;span&gt;Warning&lt;/span&gt;&lt;/em&gt;
  &lt;/p&gt;
  &lt;p&gt;Critical content demanding immediate user attention due to potential risks.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;blockquote class=&#34;alert alert-caution&#34;&gt;
  &lt;p class=&#34;alert-heading&#34;&gt;
    &lt;span aria-hidden=&#34;true&#34;&gt;&lt;svg xmlns=&#34;http://www.w3.org/2000/svg&#34; viewBox=&#34;0 0 16 16&#34; width=&#34;16&#34; height=&#34;16&#34;&gt;&lt;path d=&#34;M4.47.22A.749.749 0 0 1 5 0h6c.199 0 .389.079.53.22l4.25 4.25c.141.14.22.331.22.53v6a.749.749 0 0 1-.22.53l-4.25 4.25A.749.749 0 0 1 11 16H5a.749.749 0 0 1-.53-.22L.22 11.53A.749.749 0 0 1 0 11V5c0-.199.079-.389.22-.53Zm.84 1.28L1.5 5.31v5.38l3.81 3.81h5.38l3.81-3.81V5.31L10.69 1.5ZM8 4a.75.75 0 0 1 .75.75v3.5a.75.75 0 0 1-1.5 0v-3.5A.75.75 0 0 1 8 4Zm0 8a1 1 0 1 1 0-2 1 1 0 0 1 0 2Z&#34;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/span&gt;
    &lt;em&gt;&lt;span&gt;Caution&lt;/span&gt;&lt;/em&gt;
  &lt;/p&gt;
  &lt;p&gt;Negative potential consequences of an action.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&#34;prior-art&#34;&gt;Prior art&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://mandarismoore.com/2026/05/02/admonish-the-callout/&#34;&gt;Admonish the Callout - Mandaris&lt;/a&gt; inspired me to finally implement on my blog&lt;/li&gt;
&lt;li&gt;&lt;a href=&#34;https://github.com/antfu/markdown-it-github-alerts&#34;&gt;antfu/markdown-it-github-alerts: Support GitHub-style alerts for markdown-it&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/garden/alerts-callouts-admonitions/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>datetime-local doesn&#39;t have full cross-browser support</title>
      <link>https://www.brandonpugh.com/til/html/datetime-local-support/</link>
      <pubDate>Sun, 04 Jan 2026 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/datetime-local-support/</guid>
      <description>&lt;p&gt;I recently discovered the &lt;code&gt;datetime-local&lt;/code&gt; input type doesn&amp;rsquo;t actually have full browser support.&lt;/p&gt;
&lt;p&gt;If you have a form value that needs both a date and time component, then you might be tempted to rely on the platform to simplify your implementation and use &lt;code&gt;datetime-local&lt;/code&gt; to avoid needing two separate inputs, the values of which you&amp;rsquo;ll need to combine at some point. Unfortunately I don&amp;rsquo;t think it&amp;rsquo;s supported enough to be usable in most applications.&lt;/p&gt;
&lt;p&gt;The MDN page for &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/datetime-local&#34;&gt;datetime-local&lt;/a&gt; is a bit misleading because at the top it says it&amp;rsquo;s &amp;ldquo;Baseline widely available&amp;rdquo; but if you check the browser &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/input/datetime-local#browser_compatibility&#34;&gt;compatibility chart&lt;/a&gt; down at the bottom then you&amp;rsquo;ll see asterisks next to Firefox and Safari on Desktop and clicking that reveals that they only display a datepicker and &lt;em&gt;not&lt;/em&gt; a timepicker.&lt;/p&gt;
&lt;p&gt;This means that users have to manually type in the time which &lt;em&gt;might&lt;/em&gt; be an acceptable tradeoff but if the user doesn&amp;rsquo;t add the time then Firefox will just return &lt;code&gt;null&lt;/code&gt; as its value.&lt;/p&gt;
&lt;p&gt;Firefox did recently address these issues in Firefox 144, but as of this writing it&amp;rsquo;s still behind an &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Experimental_features#time_picker_for_datetime-local_input_field&#34;&gt;experimental flag&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;screenshot firefox new support&#34; loading=&#34;lazy&#34; src=&#34;https://www.brandonpugh.com/til/html/firefox-datetime-local-support.png&#34;&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/datetime-local-support/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>How to Optimize Viewport for Mobile for Faster Interactions | DebugBear</title>
      <link>https://www.brandonpugh.com/links/how-to-optimize-viewport-for-mobile-for-faster-interactions-debugbear/</link>
      <pubDate>Tue, 28 Oct 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/links/how-to-optimize-viewport-for-mobile-for-faster-interactions-debugbear/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.debugbear.com/blog/optimize-viewport-for-mobile&#34;&gt;How to Optimize Viewport for Mobile for Faster Interactions | DebugBear&lt;/a&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;If the viewport isn&amp;rsquo;t configured properly (e.g., the meta tag has a fixed value), mobile browsers delay all responses by up to 300 milliseconds. As a result, users will have to wait after each tap, the UI will feel sluggish, and Interaction to Next Paint (INP) scores will increase dramatically.&lt;/p&gt;
&lt;/blockquote&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/links/how-to-optimize-viewport-for-mobile-for-faster-interactions-debugbear/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Do not download the app, use the website</title>
      <link>https://www.brandonpugh.com/links/do-not-download-the-app-use-the-website/</link>
      <pubDate>Thu, 31 Jul 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/links/do-not-download-the-app-use-the-website/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://idiallo.com/blog/dont-download-apps?utm_source=cassidoo&amp;amp;utm_medium=email&amp;amp;utm_campaign=simplicity-is-the-glory-of-expression-walt-whitman&#34;&gt;Do not download the app, use the website&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/links/do-not-download-the-app-use-the-website/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>A Friendly Introduction to SVG</title>
      <link>https://www.brandonpugh.com/links/a-friendly-introduction-to-svg/</link>
      <pubDate>Wed, 23 Jul 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/links/a-friendly-introduction-to-svg/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://www.joshwcomeau.com/svg/friendly-introduction-to-svg/&#34;&gt;A Friendly Introduction to SVG • Josh W. Comeau&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is another great tutorial from Josh on the basics of SVG markup!&lt;/p&gt;
&lt;p&gt;If you want to go further, this is an awesome interactive site for understanding SVG paths:&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.nan.fyi/svg-paths&#34;&gt;Understanding SVG paths&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/links/a-friendly-introduction-to-svg/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Building Websites With LLMS</title>
      <link>https://www.brandonpugh.com/links/building-websites-with-llms/</link>
      <pubDate>Mon, 17 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/links/building-websites-with-llms/</guid>
      <description>&lt;p&gt;&lt;a href=&#34;https://blog.jim-nielsen.com/2025/lots-of-little-html-pages/&#34;&gt;Building Websites With LLMS&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve &lt;a href=&#34;https://www.brandonpugh.com/til/css/view-transition/&#34;&gt;mentioned&lt;/a&gt; the new &lt;a href=&#34;https://developer.chrome.com/docs/web-platform/view-transitions&#34;&gt;view transitions API&lt;/a&gt; before, Jim Nielsen has a great post (with a fun bait-and-switch title) where he takes it to the next level and shows how you can use cross-document transitions to take a site with regular ole html pages and make it feel like a SPA or native app.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/links/building-websites-with-llms/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Create exclusive accordions with HTML `&lt;details&gt;` element</title>
      <link>https://www.brandonpugh.com/til/html/details-accordion/</link>
      <pubDate>Thu, 13 Mar 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/details-accordion/</guid>
      <description>&lt;p&gt;Today I learned that you can now create an &amp;ldquo;exclusive accordion&amp;rdquo;, meaning only one section of the accordion is open at a time, using just html with the &lt;code&gt;details&lt;/code&gt; element.&lt;/p&gt;
&lt;p&gt;All you need to do is add a matching &lt;code&gt;name&lt;/code&gt; attribute to each &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; element you want to be considered part of the same &amp;ldquo;group&amp;rdquo;:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;details&lt;/span&gt; &lt;span class=&#34;na&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;faq&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;summary&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;Section 1&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;summary&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;p&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Section 1 details
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;p&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;details&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;details&lt;/span&gt; &lt;span class=&#34;na&#34;&gt;name&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;faq&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;summary&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;Section 2&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;summary&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;p&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Section 2 details
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;p&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;details&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Note, the &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; element has been widely supported since 2020 but support for the &lt;code&gt;name&lt;/code&gt; attribute was only added last year.&lt;/p&gt;
&lt;p&gt;Read more: &lt;a href=&#34;https://developer.mozilla.org/en-US/blog/html-details-exclusive-accordions/&#34;&gt;Exclusive accordions using the HTML details element | MDN Blog&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/details-accordion/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Use the &lt;picture&gt; element for light/dark images in markdown</title>
      <link>https://www.brandonpugh.com/til/html/light-dark-images/</link>
      <pubDate>Wed, 19 Feb 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/light-dark-images/</guid>
      <description>&lt;p&gt;Thanks to &lt;a href=&#34;https://jamesg.blog/2025/02/17/images-light-dark-css&#34;&gt;James&amp;rsquo; post&lt;/a&gt;, today I learned that you can use the &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; to display different images based on whether or not the set a preference for light or dark mode.&lt;/p&gt;
&lt;p&gt;The key is using the &lt;code&gt;prefers-color-scheme&lt;/code&gt; CSS media query&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;picture&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;source&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;na&#34;&gt;media&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;(prefers-color-scheme: dark)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;na&#34;&gt;srcset&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s&#34;&gt;      https://user-images.githubusercontent.com/25423296/163456776-7f95b81a-f1ed-45f7-b7ab-8fa810d529fa.png
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;s&#34;&gt;    &amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;img&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;na&#34;&gt;alt&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;Shows an illustrated sun in light color mode and a moon with stars in dark color mode.&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;na&#34;&gt;src&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;https://user-images.githubusercontent.com/25423296/163456779-a8556205-d0a5-45e2-ac17-42d089e3c3f8.png&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;picture&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Since HTML is valid in markdown, you can easily use this technique in a number of places including Github—which apparently has allowed the use of the &lt;code&gt;picture&lt;/code&gt; element &lt;a href=&#34;https://github.blog/changelog/2022-05-19-specify-theme-context-for-images-in-markdown-beta/&#34;&gt;since 2022.&lt;/a&gt;
This is much better than the custom syntax they had before.&lt;/p&gt;
&lt;p&gt;This also aligns with the sentiment Dave expressed that &lt;a href=&#34;https://daverupert.com/2023/05/markdown-images-anti-pattern/&#34;&gt;Markdown images are an anti-pattern&lt;/a&gt;.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/light-dark-images/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>A single input in a form can submit</title>
      <link>https://www.brandonpugh.com/til/html/single-text-field-submit/</link>
      <pubDate>Tue, 07 Jan 2025 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/single-text-field-submit/</guid>
      <description>&lt;p&gt;Today I learned that if you have a single text field in a form then browsers will automatically submit it when you press &lt;code&gt;enter&lt;/code&gt;.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-html&#34; data-lang=&#34;html&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;form&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;label&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    Search
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;input&lt;/span&gt; &lt;span class=&#34;na&#34;&gt;type&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;text&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;label&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;form&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This is kinda handy since normally you need to add a submit button to be able to submit a form — but, you should be aware that if you add another field then you &lt;em&gt;do&lt;/em&gt; need to add a submit button for the form to work.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.htmhell.dev/adventcalendar/2024/10/&#34;&gt;This post&lt;/a&gt; goes into more detail.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/single-text-field-submit/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>setSelectionRange in Safari will focus the input</title>
      <link>https://www.brandonpugh.com/til/html/setselectionrange/</link>
      <pubDate>Sun, 08 Dec 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/setselectionrange/</guid>
      <description>&lt;p&gt;Apparently in Safari, &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange&#34;&gt;&lt;code&gt;setSelectionRange()&lt;/code&gt;&lt;/a&gt; will focus the element even when not focused despite MDN stating that &amp;ldquo;The element must be focused for the call to have any effect&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;According to this &lt;a href=&#34;https://bugs.webkit.org/show_bug.cgi?id=224425&#34;&gt;bug&lt;/a&gt;, this is considered intended behavior even though it&amp;rsquo;s inconsistent with MDN and the other browsers.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s worth noting though, during my testing, I noticed that Chrome/Firefox &lt;em&gt;will&lt;/em&gt; update the selection and cursor position you just won&amp;rsquo;t see it unless you programmatically call &lt;code&gt;.focus()&lt;/code&gt; on the element.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/setselectionrange/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>SRI integrity hash algorithms</title>
      <link>https://www.brandonpugh.com/til/html/sri-hash-algorithm/</link>
      <pubDate>Tue, 12 Nov 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/sri-hash-algorithm/</guid>
      <description>&lt;p&gt;Today I learned that you can actually specify different hash algorithms for &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity&#34;&gt;Subresource Integrity&lt;/a&gt; (SRI) hashes.&lt;/p&gt;
&lt;p&gt;If you aren&amp;rsquo;t familiar with SRI, &lt;a href=&#34;https://frontendmasters.com/blog/script-integrity/&#34;&gt;this post&lt;/a&gt; does a good job explaining why it&amp;rsquo;s useful and how it would have mitigated the recent &lt;a href=&#34;https://www.securityweek.com/polyfill-supply-chain-attack-hits-over-100k-websites/&#34;&gt;pollyfill.io incident&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I needed to add the hashes to some scripts from a third party CDN that didn&amp;rsquo;t provide them and I came across this handy &lt;a href=&#34;https://www.srihash.org/&#34;&gt;generator&lt;/a&gt; which let&amp;rsquo;s you choose which algorithm to use and defaults to SHA-384 and &lt;a href=&#34;https://report-uri.com/home/sri_hash&#34;&gt;report-uri&lt;/a&gt; has a generator that just includes &lt;em&gt;all 3 different hashes&lt;/em&gt; in the &lt;code&gt;integrity&lt;/code&gt; value.&lt;/p&gt;
&lt;p&gt;So which one to use?&lt;/p&gt;
&lt;p&gt;Apparently you can specify different hashes but there isn&amp;rsquo;t much value in doing so at the moment since all modern browsers support all of the available algorithms so you should just pick &lt;strong&gt;&lt;code&gt;SHA512&lt;/code&gt;&lt;/strong&gt;.
In the future however, newer algorithms might be implemented which you could add while maintaining backwards compatibility.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/sri-hash-algorithm/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>History API state</title>
      <link>https://www.brandonpugh.com/til/html/history-state/</link>
      <pubDate>Mon, 07 Oct 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/history-state/</guid>
      <description>&lt;p&gt;Today I learned that you can actually store state in the browser history via the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/API/History&#34;&gt;history API&lt;/a&gt; (note this is not the query string).&lt;/p&gt;
&lt;p&gt;I came across in &lt;a href=&#34;https://darekkay.com/blog/preserve-form-values/&#34;&gt;this post&lt;/a&gt; that uses it as a clever method for temporarily storing form data.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/history-state/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Drag and drop upload</title>
      <link>https://www.brandonpugh.com/til/html/drag-drop-upload/</link>
      <pubDate>Wed, 24 Jul 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/drag-drop-upload/</guid>
      <description>&lt;p&gt;Today I learned that creating a nice drag-and-drop file component using vanilla javascript and the built web APIs is actually fairly easy.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://www.smashingmagazine.com/2018/01/drag-drop-file-uploader-vanilla-js/&#34;&gt;Smashing Magazine&lt;/a&gt; has an easy-to-follow example.&lt;/p&gt;
&lt;p&gt;The gist of it is that the browser gives you &lt;code&gt;&#39;dragenter&#39;, &#39;dragover&#39;, &#39;dragleave&#39;&lt;/code&gt; events that you can use to style your &amp;ldquo;dropzone&amp;rdquo; however you want and the &lt;code&gt;drop&lt;/code&gt; event allows you to handle the files themselves:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-js&#34; data-lang=&#34;js&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nx&#34;&gt;dropArea&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;addEventListener&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s1&#34;&gt;&amp;#39;drop&amp;#39;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;handleDrop&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;false&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kd&#34;&gt;function&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;handleDrop&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kd&#34;&gt;let&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;dt&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;dataTransfer&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;kd&#34;&gt;let&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;files&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;dt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;files&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;c1&#34;&gt;// implement with your preferred upload method
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;nx&#34;&gt;uploadFiles&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;files&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The &lt;code&gt;dragevent&lt;/code&gt; and &lt;code&gt;dataTransfer&lt;/code&gt; interface have been supported in modern browsers for some time so they are pretty safe to use.&lt;/p&gt;
&lt;p&gt;Alternatively, if you don&amp;rsquo;t care about styling a fancy drop area, the standard HTML &lt;code&gt;&amp;lt;input type=&amp;quot;file&amp;quot;&amp;gt;&lt;/code&gt; element supports dragging a file onto it.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/drag-drop-upload/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Input modes</title>
      <link>https://www.brandonpugh.com/til/html/input-modes/</link>
      <pubDate>Wed, 17 Jul 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/input-modes/</guid>
      <description>&lt;p&gt;Today I learned that iOS changed the way it handles the &lt;code&gt;inputmode=&amp;quot;numeric&amp;quot;&lt;/code&gt; attribute on HTML input elements.&lt;/p&gt;
&lt;p&gt;It used to display the full number keyboard as shown here:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;screenshot of IOS numeric keyboard from version 12.2 which is just the regular keyboard but starting on the number and symbols view&#34; loading=&#34;lazy&#34; src=&#34;https://www.brandonpugh.com/til/html/ios-original-keyboard.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;I couldn&amp;rsquo;t find it documented anywhere but, after testing various versions on BrowserStack, I found that starting with iOS 14 the &lt;code&gt;numeric&lt;/code&gt; keyboard is the same as &lt;code&gt;decimal&lt;/code&gt; but without the decimal key:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;screenshot of IOS keyboard showing only the 10 large number keys&#34; loading=&#34;lazy&#34; src=&#34;https://www.brandonpugh.com/til/html/ios-numeric-keyboard.png&#34;&gt;&lt;/p&gt;
&lt;p&gt;This is overall an improvement in usability I think except if you need to allow the user to enter negative numbers. So something to be aware of since I couldn&amp;rsquo;t find any way to type the &lt;code&gt;-&lt;/code&gt; with that attribute set.&lt;/p&gt;
&lt;p&gt;Unfortunately, all the sites I found that discuss inputmodes, show the old version like &lt;a href=&#34;https://css-tricks.com/better-form-inputs-for-better-mobile-user-experiences/&#34;&gt;this post&lt;/a&gt; but it&amp;rsquo;s still a good resource and I recommend setting an inputmode where it makes to make it easier to type certain values on mobile devices.&lt;/p&gt;
&lt;p&gt;Also, I like how Android handles it better:&lt;/p&gt;
&lt;p&gt;&lt;img alt=&#34;screenshot of android numeric keyboards which in addition to the large number keys also has comma, dot, dash, and space keys&#34; loading=&#34;lazy&#34; src=&#34;https://www.brandonpugh.com/til/html/android-numeric-keyboard.png&#34;&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/input-modes/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>BFCache</title>
      <link>https://www.brandonpugh.com/til/html/bfcache/</link>
      <pubDate>Tue, 21 May 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/bfcache/</guid>
      <description>&lt;p&gt;Today I learned that the Backwards/forwards cache (BFCache) is a thing.
This is the cache where the browser keeps a snapshot of a webpage so that it&amp;rsquo;s able to display almost instantly when a user clicks the back or forward buttons.&lt;/p&gt;
&lt;p&gt;This post gives a nice &lt;a href=&#34;https://www.sabatino.dev/bfcache-explained/&#34;&gt;overview of the BFCache&lt;/a&gt; and how it works — apparently &amp;ldquo;Chrome usage data shows that 1 in 10 navigations on desktop and 1 in 5 on mobile are either back or forward&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;The Chrome Devtools also has a feature to let you &lt;a href=&#34;https://developer.chrome.com/docs/devtools/application/back-forward-cache&#34;&gt;test if your page is cacheable&lt;/a&gt; in the BFCache.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/bfcache/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Preload critical assets</title>
      <link>https://www.brandonpugh.com/til/html/preload-assets/</link>
      <pubDate>Wed, 13 Mar 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/preload-assets/</guid>
      <description>&lt;p&gt;Today I learned that you can preload critical assets in a page by using the &lt;code&gt;preload&lt;/code&gt; attribute on a link tag i.e. &lt;code&gt;&amp;lt;link rel=&amp;quot;preload&amp;quot;&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;Especially useful for things like fonts that are discovered later by the browser.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://web.dev/articles/preload-critical-assets&#34;&gt;Preload critical assets to improve loading speed&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/preload-assets/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>CSP `connect-src` directive</title>
      <link>https://www.brandonpugh.com/til/html/csp-connect-src/</link>
      <pubDate>Fri, 26 Jan 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/csp-connect-src/</guid>
      <description>&lt;p&gt;Today I learned that there is a Content-Security-Policy (CSP) directive &lt;code&gt;connect-src&lt;/code&gt; that you can use to restrict all outgoing requests from your website to only the domains that you specify.&lt;/p&gt;
&lt;p&gt;This is a powerful mitigation against any kind of script injection attacks since no data can then be exfiltrated from your page.&lt;/p&gt;
&lt;p&gt;It applies to &lt;code&gt;XMLHttpRequest&lt;/code&gt; (AJAX), &lt;code&gt;WebSocket&lt;/code&gt;, &lt;code&gt;fetch()&lt;/code&gt;, &lt;code&gt;&amp;lt;a ping&amp;gt;&lt;/code&gt; or &lt;code&gt;EventSource&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;CSP is an HTTP response header for enhancing the security of a site and there are of course several other directives you might want to enable.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://content-security-policy.com/&#34;&gt;This is a handy reference&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If you want to see a real-world comprehensive example, take a look at the &lt;a href=&#34;https://report-uri.com/home/analyse/https%3A%2F%2Fhaveibeenpwned.com%2F&#34;&gt;CSP header for haveibeenpwned.com&lt;/a&gt; (this links to &lt;a href=&#34;https://report-uri.com/home/analyse&#34;&gt;the csp analyser from report-uri&lt;/a&gt;).&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/csp-connect-src/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Disable entire form</title>
      <link>https://www.brandonpugh.com/til/html/disable-form/</link>
      <pubDate>Wed, 24 Jan 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/disable-form/</guid>
      <description>&lt;p&gt;Today I learned that you can disable an entire form by wrapping all the inputs in a &lt;code&gt;&amp;lt;fieldset disabled&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;You might think that you can disable a form with &lt;code&gt;&amp;lt;form disabled&amp;gt;&lt;/code&gt; but unfortunately, the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/form&#34;&gt;form element&lt;/a&gt; doesn&amp;rsquo;t have a disabled attribute.&lt;/p&gt;
&lt;p&gt;Fieldsets are typically used to group related form elements (and in some cases can improve accessibility) — so you can have multiple in a form and disable portions of the form separately.&lt;/p&gt;
&lt;p&gt;This is much more convenient than having to toggle the &lt;code&gt;disabled&lt;/code&gt; attributes on every form element.&lt;/p&gt;
&lt;p&gt;I also learned that there is a difference between styling a button with &lt;code&gt;button:disabled&lt;/code&gt; and &lt;code&gt;button[disabled]&lt;/code&gt;, the former being the one you want to use in this case since the latter only matches a button with a disabled attribute.&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://linkedlist.ch/disabling_an_entire_form_in_html_37/&#34;&gt;Disabling an entire form in HTML&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/disable-form/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Thin Space</title>
      <link>https://www.brandonpugh.com/til/html/thin-space/</link>
      <pubDate>Fri, 12 Jan 2024 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/thin-space/</guid>
      <description>&lt;p&gt;Today I learned that there is an HTML entity called &amp;ldquo;thin space&amp;rdquo; that you can use when you need less space between two characters than the normal space.&lt;/p&gt;
&lt;p&gt;The HTML code is &lt;code&gt;&amp;amp;thinsp;&lt;/code&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Thin Space might be the most underrated HTML entity. It can be used for a name like J. K. Simmons. Without spacing, the J and K would seem too close together; with a regular space, they seem too far apart. Insert a thin space and it is just perfect. - &lt;a href=&#34;https://codepen.io/mikemai2awesome/full/qBygNwq&#34;&gt;Typography Manual&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href=&#34;https://codepen.io/mikemai2awesome/pen/LYQwBmp&#34;&gt;You can see a demo here&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/thin-space/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>The `datalist` HTML element</title>
      <link>https://www.brandonpugh.com/til/html/datalist/</link>
      <pubDate>Mon, 20 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/datalist/</guid>
      <description>&lt;p&gt;Today I learned that there&amp;rsquo;s now an HTML element called &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTML/Element/datalist&#34;&gt;&lt;code&gt;datalist&lt;/code&gt;&lt;/a&gt; that&amp;rsquo;s basically an autocomplete-like input element.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/datalist/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Disabled buttons are bad for accessibility</title>
      <link>https://www.brandonpugh.com/til/html/disabled-buttons-bad-accessibility/</link>
      <pubDate>Fri, 10 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/disabled-buttons-bad-accessibility/</guid>
      <description>&lt;p&gt;Today I learned that disabled buttons are potentially bad for accessibility.&lt;/p&gt;
&lt;p&gt;I realized long ago that disabled buttons can be bad for UX but I just saw Chris Ferdinandi&amp;rsquo;s post &lt;a href=&#34;https://gomakethings.com/dont-disable-buttons/&#34;&gt;Don&amp;rsquo;t Disable Buttons&lt;/a&gt;, and learned that disabled buttons aren&amp;rsquo;t focusable which means they don&amp;rsquo;t work well with screen readers or navigating with the keyboard.&lt;/p&gt;
&lt;p&gt;I usually recommend against disabling form submit buttons when there are validation errors because the user has no feedback as to &lt;em&gt;why&lt;/em&gt; it&amp;rsquo;s disabled, but Chris gives the example of disabling while the form is being submitted (which I&amp;rsquo;ve probably done in the past) and he goes into detail about the issues with this approach and a good alternative.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/disabled-buttons-bad-accessibility/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Blob URLs</title>
      <link>https://www.brandonpugh.com/til/html/blob-url/</link>
      <pubDate>Thu, 02 Nov 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/blob-url/</guid>
      <description>&lt;p&gt;Today I learned that in a web page, when you&amp;rsquo;re working with Blob or File objects you can call &lt;code&gt;URL.createObjectURL()&lt;/code&gt; to create a Blob URL that can be used as the source for anything that normally takes a URL like images or download links.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s also apparently a good alternative to base64 encoded Data-URIs especially when dealing with larger amounts of data since a base64 encoded file will be 33% larger than the raw binary.&lt;/p&gt;
&lt;p&gt;I was running into issues trying to embed a large PDF with the &lt;code&gt;&amp;lt;object&amp;gt;&lt;/code&gt; element and instead of setting a massive base64 string as the data source, I was able to convert it to a blob and use a blob url so it ends up looking something like:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;object data=&amp;quot;blob:https://localhost/d827ea99-9e80-496a-a8e0-e107b83080e9&amp;quot; type=&amp;quot;application/pdf&amp;quot;&amp;gt;&amp;lt;/object&amp;gt;&lt;/code&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/blob-url/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Use the `valueAsNumber` property of html number inputs</title>
      <link>https://www.brandonpugh.com/til/html/valueasnumber/</link>
      <pubDate>Mon, 02 Oct 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/valueasnumber/</guid>
      <description>&lt;p&gt;Today I learned about the &lt;code&gt;valueAsNumber&lt;/code&gt; property of html number inputs.&lt;/p&gt;
&lt;p&gt;So instead of having to parse the value like: &lt;code&gt;const num = parseFloat(e.target.value)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;You can do: &lt;code&gt;const num = e.target.valueAsNumber&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;For example in react:&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-jsx&#34; data-lang=&#34;jsx&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;return&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&#34;nt&#34;&gt;input&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;na&#34;&gt;type&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;number&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;na&#34;&gt;value&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;number&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;na&#34;&gt;onChange&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;{(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;c1&#34;&gt;// ✅
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;kr&#34;&gt;const&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;num&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;nx&#34;&gt;e&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;target&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;valueAsNumber&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;        &lt;span class=&#34;nx&#34;&gt;setNumber&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nx&#34;&gt;num&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;      &lt;span class=&#34;p&#34;&gt;}}&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;p&#34;&gt;/&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;  &lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;&lt;a href=&#34;https://www.builder.io/blog/numbers-and-dates&#34;&gt;Work With Number and Date Inputs in JavaScript&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/valueasnumber/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>SVG sprites</title>
      <link>https://www.brandonpugh.com/til/html/svg-sprites/</link>
      <pubDate>Thu, 28 Sep 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/svg-sprites/</guid>
      <description>&lt;p&gt;Today I learned about the &lt;code&gt;&amp;lt;use&amp;gt;&lt;/code&gt; element and how you can use it to create &lt;a href=&#34;https://benadam.me/thoughts/react-svg-sprites/&#34;&gt;&lt;em&gt;SVG&lt;/em&gt; sprites&lt;/a&gt;.
It turns out that my preferred way of working with svgs in react by embedding them in the components, &lt;a href=&#34;https://kurtextrem.de/posts/svg-in-js&#34;&gt;is not great for performance&lt;/a&gt; or bundle size.
But as &lt;a href=&#34;https://benadam.me/thoughts/react-svg-sprites/&#34;&gt;Ben Adam&amp;rsquo;s post shows&lt;/a&gt;, it looks like inline svgs using sprites gives you the best performance to development experience tradoff.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/svg-sprites/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>One-time code autocomplete</title>
      <link>https://www.brandonpugh.com/til/html/one-time-code-autocomplete/</link>
      <pubDate>Wed, 27 Sep 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/one-time-code-autocomplete/</guid>
      <description>&lt;p&gt;I just discovered that there is a &lt;code&gt;autocomplete=&amp;quot;one-time-code&amp;quot;&lt;/code&gt; value you can use on mobile devices where the operating system will autopopulate the field with a code that the user receives via SMS.
I haven&amp;rsquo;t had a chance to test it out but it seems pretty cool and I wish every banking site would just add this one html attribute (since they seem unable to add any MFA option other than SMS).&lt;/p&gt;
&lt;p&gt;&lt;a href=&#34;https://web.dev/articles/sms-otp-form#autocompleteone-time-code&#34;&gt;SMS OTP code&lt;/a&gt;&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/one-time-code-autocomplete/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>Disabling browser autofill in a form</title>
      <link>https://www.brandonpugh.com/til/html/disable-autocomplete/</link>
      <pubDate>Fri, 15 Sep 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/disable-autocomplete/</guid>
      <description>&lt;p&gt;Today I learned that &lt;code&gt;autocomplete=&amp;quot;off&amp;quot;&lt;/code&gt; tends to be completely ignored by browsers these days because they seem to have the attitude that websites don&amp;rsquo;t use it correctly.&lt;/p&gt;
&lt;p&gt;Apparently the best way to prevent a browser from trying to autofill a field is to tell the browser it&amp;rsquo;s not the field it thinks it is with something like &lt;code&gt;autocomplete=&amp;quot;something-else&amp;quot;&lt;/code&gt;.
If it&amp;rsquo;s anything the browser doesn&amp;rsquo;t recognize it won&amp;rsquo;t try to fill it.
It looks like &lt;code&gt;autocomplete=&amp;quot;new-password&amp;quot;&lt;/code&gt; is one people tend to use especially for any &lt;code&gt;type=&amp;quot;password&amp;quot;&lt;/code&gt; fields that aren&amp;rsquo;t actually meant to be a user&amp;rsquo;s login password.
See this &lt;a href=&#34;https://stackoverflow.com/questions/15738259/disabling-chrome-autofill&#34;&gt;StackOverflow question&lt;/a&gt; for more discussion.&lt;/p&gt;
&lt;p&gt;Likewise if you want to give the browser hints about what it should​​​​​​​ try to suggest you can use one of the &lt;a href=&#34;https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete#values&#34;&gt;recognized values&lt;/a&gt; like &lt;code&gt;address-line1&lt;/code&gt;.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/disable-autocomplete/feed&quot;&gt;
      </description>
    </item>
    
    <item>
      <title>A hidden button in an HTML form can be submitted</title>
      <link>https://www.brandonpugh.com/til/html/hidden-button-still-submits/</link>
      <pubDate>Tue, 25 Jul 2023 00:00:00 +0000</pubDate>
      <guid>https://www.brandonpugh.com/til/html/hidden-button-still-submits/</guid>
      <description>&lt;p&gt;Even if a button is hidden with &lt;code&gt;display: none&lt;/code&gt;, if it has a type of &lt;code&gt;submit&lt;/code&gt; then it will still be activated if it&amp;rsquo;s the first button in a form and a user hits enter in a form field.&lt;/p&gt;
&lt;p&gt;So it&amp;rsquo;s a good reason to always explicitly specify the type of a button since &lt;code&gt;submit&lt;/code&gt; is the default but most of the time you want &lt;code&gt;type=&amp;quot;button&amp;quot;&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;FYI there&amp;rsquo;s an &lt;a href=&#34;https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/button-has-type.md&#34;&gt;eslint rule&lt;/a&gt; for this for react.&lt;/p&gt;

       &lt;hr&gt; &lt;p&gt;Thank you for keeping RSS alive. You&#39;re awesome.&lt;/p&gt; &lt;p&gt;&lt;a href=&#34;mailto:blogrss@bpugh.dev&#34;&gt;Reply by email&lt;/a&gt;&lt;/p&gt;
        &lt;img src=&quot;https://blog.bpugh.workers.dev/cdn/images?p=/til/html/hidden-button-still-submits/feed&quot;&gt;
      </description>
    </item>
    
  </channel>
</rss>