<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Frontend on Duma's website</title><link>https://dumaron.github.io/tags/frontend/</link><description>Recent content in Frontend on Duma's website</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Sat, 14 Feb 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://dumaron.github.io/tags/frontend/index.xml" rel="self" type="application/rss+xml"/><item><title>&lt;code&gt;inputMode&lt;/code&gt; HTML attribute</title><link>https://dumaron.github.io/notes/tils/2026-02-13_inputmode_attribute/</link><pubDate>Sat, 14 Feb 2026 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2026-02-13_inputmode_attribute/</guid><description>&lt;p&gt;While working on a form with numeric inputs, I noticed Claude putting this attribute on them: &lt;code&gt;inputMode=&amp;quot;numeric&amp;quot;&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;Intrigued, I looked at the &#10;&#10;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/inputmode" rel="noopener" target="_blank"&gt;MDN page&lt;/a&gt; and it turns out the attribute exists to support different input styles, mostly related to what a smartphone will show in the keyboard tray. It can take values like &lt;code&gt;tel&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt;, &lt;code&gt;numeric&lt;/code&gt; and so on.&lt;/p&gt;&#10;&lt;p&gt;The attribute&amp;rsquo;s effect is limited to the keyboard, and it relies on the specific vendor to act on it. Nevertheless, I find it pretty useful to be able to change the keyboard between &lt;code&gt;numeric&lt;/code&gt; and &lt;code&gt;decimal&lt;/code&gt; depending on the value that needs to be entered in a form field.&lt;/p&gt;</description></item><item><title>&lt;code&gt;datalist&lt;/code&gt; for range inputs</title><link>https://dumaron.github.io/notes/tils/2024-08-27_datalist_for_range_inputs/</link><pubDate>Tue, 27 Aug 2024 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2024-08-27_datalist_for_range_inputs/</guid><description>&lt;p&gt;The &lt;code&gt;datalist&lt;/code&gt; tag has surprised me at least a couple time already. While I still consider native HTML inputs as inadequate and too rigid, I admit that thanks to the &lt;code&gt;datalist&lt;/code&gt; tag the UX can improve a bit.&lt;/p&gt;&#10;&lt;p&gt;Today I was how far the native range inputs are from for &#10;&#10;&lt;a href="https://eui.elastic.co/#/forms/range-sliders" rel="noopener" target="_blank"&gt;ElasticUI range inputs&lt;/a&gt;, the one I currently use. I stumbled upon the MDN Web docs page and particularly &#10;&#10;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/range#list" rel="noopener" target="_blank"&gt;on the &lt;code&gt;list&lt;/code&gt; attribute&lt;/a&gt;: it can contain the &lt;code&gt;id&lt;/code&gt; of a &lt;code&gt;datalist&lt;/code&gt; component and to enhance the user experience of the input. It seems the only three ways these two tags can interact are:&lt;/p&gt;</description></item><item><title>Mutable &lt;code&gt;shared static&lt;/code&gt; attributes in Javascript</title><link>https://dumaron.github.io/notes/tils/2024-02-23_mutable_shared_static_attributes/</link><pubDate>Mon, 11 Mar 2024 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2024-02-23_mutable_shared_static_attributes/</guid><description>&lt;p&gt;My understanding of the &lt;code&gt;static&lt;/code&gt; keyword in JS classes has always been that it determined immutable attributes/methods that are available before not on a class instance but on the class constructor itself. Like with the &lt;code&gt;Object&lt;/code&gt; class constrctor: it is possible to instantiate it, but some methods are available on the constructor too, like &lt;code&gt;.fromEntries()&lt;/code&gt;.&lt;/p&gt;&#10;&lt;p&gt;Let&amp;rsquo;s see a working example:&lt;/p&gt;&#10;&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#b4b4b4;background-color:#121212;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-js" data-lang="js"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b14242"&gt;class&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;MyClass&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;{&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#b14242"&gt;static&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;attr1&lt;/span&gt; &lt;span style="color:#d87c4a"&gt;=&lt;/span&gt; &lt;span style="color:#df6464"&gt;&amp;#39;attr1&amp;#39;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#d5d5d5"&gt;attr2&lt;/span&gt; &lt;span style="color:#d87c4a"&gt;=&lt;/span&gt; &lt;span style="color:#df6464"&gt;&amp;#39;attr2&amp;#39;&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#b14242"&gt;static&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;method1&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;()&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;{&lt;/span&gt; &lt;span style="color:#b14242"&gt;return&lt;/span&gt; &lt;span style="color:#df6464"&gt;&amp;#39;method1&amp;#39;&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt; &lt;span style="color:#d5d5d5"&gt;method2&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;()&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;{&lt;/span&gt; &lt;span style="color:#b14242"&gt;return&lt;/span&gt; &lt;span style="color:#df6464"&gt;&amp;#39;method2&amp;#39;&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;}&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;group&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#df6464"&gt;&amp;#39;Constructor&amp;#39;&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;MyClass&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;attr1&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;MyClass&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;attr2&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;)&lt;/span&gt; &lt;span style="color:#737373;font-style:italic"&gt;// &amp;lt;- doesn&amp;#39;t throw, but undefined&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;MyClass&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;method1&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;())&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;MyClass&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;method2&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;())&lt;/span&gt; &lt;span style="color:#737373;font-style:italic"&gt;// &amp;lt;- throws&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;groupEnd&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#b14242"&gt;const&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;instance&lt;/span&gt; &lt;span style="color:#d87c4a"&gt;=&lt;/span&gt; &lt;span style="color:#b14242"&gt;new&lt;/span&gt; &lt;span style="color:#d5d5d5"&gt;MyClass&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;group&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#df6464"&gt;&amp;#39;Instance&amp;#39;&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;instance&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;attr1&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;)&lt;/span&gt; &lt;span style="color:#737373;font-style:italic"&gt;// &amp;lt;- doesn&amp;#39;t throw, but undefined&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;instance&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;attr2&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;)&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;instance&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;method1&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;())&lt;/span&gt; &lt;span style="color:#737373;font-style:italic"&gt;// &amp;lt;- throws&#10;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;log&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;(&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;instance&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;method2&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;())&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#d5d5d5"&gt;console&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;.&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;groupEnd&lt;/span&gt;&lt;span style="color:#d5d5d5"&gt;()&lt;/span&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;As you can see, static method are available on the constructor only, while &amp;ldquo;normal&amp;rdquo; method only on instances. So far so good.&lt;/p&gt;</description></item><item><title>&lt;code&gt;:has()&lt;/code&gt; pseudo-selector and current node parent</title><link>https://dumaron.github.io/notes/tils/2024-02-02_has_selector_and_node_parent/</link><pubDate>Fri, 02 Feb 2024 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2024-02-02_has_selector_and_node_parent/</guid><description>&lt;p&gt;Today I was finally able to use the &lt;code&gt;:has()&lt;/code&gt; pseudo-selector. I&amp;rsquo;ve heard about that in a superficial way through articles and comments, but I&amp;rsquo;ve never it in person.&lt;/p&gt;&#10;&lt;p&gt;Today at work I needed to implement a workaround, which consisted in &lt;strong&gt;setting some CSS rules to the parent of the current node&lt;/strong&gt;. I&amp;rsquo;ve always thought it was impossible to achieve, but good folks updated &#10;&#10;&lt;a href="https://stackoverflow.com/questions/1014861/is-there-a-css-parent-selector" rel="noopener" target="_blank"&gt;this old question on StackOverflow&lt;/a&gt;, explaining how &lt;code&gt;:has()&lt;/code&gt; could have helped.&lt;/p&gt;</description></item><item><title>Better viewport units for responsive design</title><link>https://dumaron.github.io/notes/tils/2024-02-01_better_viewport_units_for_responsive_design/</link><pubDate>Thu, 01 Feb 2024 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2024-02-01_better_viewport_units_for_responsive_design/</guid><description>&lt;p&gt;&lt;strong&gt;The issue is&lt;/strong&gt;: using &lt;code&gt;100vh&lt;/code&gt; as a rule to measure the whole viewport height is just faulty on mobile. Ona side note, I belive most of the times this is a bad idea, and people actually want something different, but let&amp;rsquo;s avoid this topic.&lt;/p&gt;&#10;&lt;p&gt;I encountered this issue again today, where one of the web apps I work on has &lt;code&gt;100vh&lt;/code&gt; but now has also the need to be more mobile-friendly.&lt;/p&gt;</description></item><item><title>Web Components innerHTML and loading time</title><link>https://dumaron.github.io/notes/tils/2024-01-30_webc_innerhtml_and_loading_time/</link><pubDate>Tue, 30 Jan 2024 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2024-01-30_webc_innerhtml_and_loading_time/</guid><description>&lt;p&gt;While approaching the first lessons of &#10;&#10;&lt;a href="https://www.bluespire.com/p/web-component-engineering" rel="noopener" target="_blank"&gt;Rob Eisenberg&amp;rsquo;s Web Components course&lt;/a&gt;, I stumpled upon a browser error that prevented every instance&#10;of a web component to run:&lt;/p&gt;&#10;&lt;pre tabindex="0"&gt;&lt;code&gt;Failed to construct &amp;#39;CustomElement&amp;#39;: The result must not have children&amp;#34;&#10;&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;After many trials and errors, it turned out that adding the &lt;code&gt;type=&amp;quot;module&amp;quot;&lt;/code&gt; attribute fixed the issue. But why?&#10;I asked Rob directly &#10;&#10;&lt;a href="https://twitter.com/Duma_ron/status/1752283582368731598" rel="noopener" target="_blank"&gt;in this tweet&lt;/a&gt;, and here&amp;rsquo;s his answer:&lt;/p&gt;&#10;&lt;blockquote&gt;&lt;p&gt;Technically, one shouldn&amp;rsquo;t alter the host attributes or children in the constructor (there&amp;rsquo;s a note on attributes but not children in the lesson; I&amp;rsquo;ll add more on that). Though, it will work in certain scenarios. Setting innerHTML in the constructor is an example of where it will work, depending on the timing.&lt;/p&gt;</description></item><item><title>Child rule does not mean child element</title><link>https://dumaron.github.io/notes/tils/2024-01-15_child_rule_does_not_mean_child_element/</link><pubDate>Mon, 15 Jan 2024 00:00:00 +0000</pubDate><guid>https://dumaron.github.io/notes/tils/2024-01-15_child_rule_does_not_mean_child_element/</guid><description>&lt;p&gt;I always tought that, either in SASS or in native CSS nested selector, it was possible only to refine a selector by appending attributes of child nodes. It turns out it isn&amp;rsquo;t so.&lt;/p&gt;&#10;&lt;p&gt;In other words, whenever the &lt;code&gt;&amp;amp;&lt;/code&gt; is used in selectors it&amp;rsquo;s possible to write &lt;code&gt;body &amp;amp;&lt;/code&gt; and it&amp;rsquo;ll create a legit selector. I expected that only refinements like &lt;code&gt;&amp;amp; .some-children-class&lt;/code&gt; would work.&lt;/p&gt;&#10;&lt;p&gt;This is a partial example to show the mechanism: the haiku is green, while I would have expected it to be blue.&lt;/p&gt;</description></item></channel></rss>