Notes

  • Note - Posted on

    Today I learned, via Calibre’s article on Lazy Loading Images, there is a difference in how far ahead each browser fetches lazy images.

    BrowserImagesIframesVideo and audio
    Chrome, 4G1,250px2,500px1,250px
    Chrome, 3G2,500px3,500px2,500px
    Chrome, 2G6,000px6,000px6,000px
    Firefox600px600pxNot supported
    SafariOne viewport0pxNot supported

    Additionally, there is a difference in how horizontal lazy loading works in Chrome, Safari and Firefox. Via web.dev’s article on Browser-level image lazy loading for the web:

    Chrome 121 changed the behavior for horizontal-scrolling images like carousels. These now use the same thresholds as vertical scrolling. This means for the carousel use case, images will be loaded before they visible in the viewport. This means the image loading is less likely to be noticeable to the user, but at the cost of more downloads. Use the Horizontal Lazy Loading demo to compare behaviour in Chrome versus Safari and Firefox.

  • Note - Posted on

    Today I learned, lazy loading only works when JavaScript is enabled.

    As per the HTML spec,

    This is an anti-tracking measure, because if a user agent supported lazy loading when scripting is disabled, it would still be possible for a site to track a user’s approximate scroll position throughout a session, by strategically placing images in a page’s markup such that a server can track how many images are requested and when.

  • Note - Posted on

    Today I learned, elements with a positive tabindex value are focused first, from the lowest value up, before tabindex=“0” in sequential keyboard navigation.

    I was completely unaware of this behaviour. I guess because I had only ever used tabindex=“0” (for scrollable overflow containers) and tabindex=“-1” (to remove an element from sequential keyboard navigation) until now.

    Also, via MDN’s reference page on tabindex HTML global attribute:

    Some focusable HTML elements have a default tabindex value of 0 set under the hood by the user agent. These elements are an <a> or <area> with href attribute, <button>, <frame> , <iframe>, <input>, <object>, <select>, <textarea>, and SVG <a> element, or a <summary> element that provides summary for a <details> element.

  • Note - Posted on

    What’s the value of b after the following code runs?

    let a = 10;
    let b = a;
    a = 0;

    It’s 10. Even though I had gotten it right, I couldn’t have explained why.

    Dan Abramov and Maggie Appleton’s course, Just JavaScript, helped me develop a better mental model of how it works and now it’s free to access for everyone.

  • Note - Posted on

    tabindex="-1" (or any negative value) makes an element focusable if it isn’t already, and removes it from the tab order. It can still receive focus programmatically or by click, but not via the Tab key.

  • Note - Posted on

    Today I learned that modal <dialog>s opened with showModal() can have their own <h1>.

    I discovered this while reading Modern Web Guidance’s HTML guide. I was skeptical at first because it’s bad practice to have multiple <h1>s on a single web page.

    But this exception for modal dialogs made sense when I learned what showModal() does. It makes the rest of the page inert and as mentioned on MDN, inert HTML elements and their flat tree descendants are hidden from assistive technologies as they are excluded from the accessibility tree. So while the modal dialog is open there is no other <h1> to compete with.

    I’m not sure if there is consensus on this because I have seen many examples where an <h2> was used instead.

  • Note - Posted on

    Today I learned, through Sara Soueidan’s course, Practical Accessibility, that spectacles/eyeglasses are a form of assistive technology.

    I’ve worn glasses for most of my life, but I’ve never really thought of myself as someone who uses assistive technology.

    It made me realize how easily we can think of assistive technology as something that exists for “people with disabilities,” rather than something many of us may rely on ourselves.

  • Note - Posted on

    I’ve put hours into learning CSS over the years and continue to do so happily. Building things with HTML and CSS is the part of the work I enjoy the most.

    But it always felt like there were gaps in my knowledge. So I just enrolled in Poetic CSS to finally understand it from the inside out.

  • Note - Posted on

    Today I learned via Paweł Grzybek’s post on Mastodon, where Temani Afif pointed out that text decorations propagate to their descendants, they aren’t inherited.

    The difference between propagation and inheritance is that the descendants don’t get their own text-decoration property. So, the line, color, style and thickness are all determined by the ancestor where text-decoration was declared.

    A descendant can still declare its own text-decoration, but that creates an additional decoration on top, it doesn’t modify or remove the ancestor’s.

  • Note - Posted on

    Today I learned, adding tabindex="-1" to skip link targets is likely no longer necessary in modern browsers.

    Manuel Matuzović tested skip links without tabindex="-1" on targets across major browsers and screen readers on macOS, Windows and Android, concluding it is safe to remove in most setups, thanks to sequential focus navigation starting point.

    Furthermore, adding tabindex="-1" to skip link targets also introduces a regression in usability. With tabindex="-1" on main, clicking on any non-interactive area inside main makes main itself the focus starting point. So, the next tab press sends focus to the first focusable element in main, not the next one after where the user clicked. The gov.uk team removed tabindex from main for this reason.

  • Note - Posted on

    Today, while working through an exercise in Eloquent JavaScript, I learned about the concept of parity in maths.

    The parity of an integer is its attribute of being even or odd. Thus, it can be said that 6 and 14 have the same parity (since both are even), whereas 7 and 12 have opposite parity (since 7 is odd and 12 is even).

    – Weisstein, Eric W, Parity

    Initially, I had assumed “same parity” meant “same value”, which is roughly what it means in English. However, in maths it’s narrower. It just means both numbers are even or both are odd.

  • Note - Posted on

    Just watched the latest Whiskey Web and Whatnot episode with Chris Coyier and Dave Rupert. No one would’ve guessed that I was watching a web dev podcast from how much I was laughing.

    At one point in the episode Adam mentions, “holy crap, my job is now leftover tokens in a burn window”. If Adam can feel like AI is making his work redundant then what hope do I have? 🙈

  • Note - Posted on

    Last week, I built a visual explainer of the CSS Cascade.

    I used anchor positioning with chained anchors to stack the cascade steps. It worked, but Safari 26.4 and earlier had a bug with chained anchors, so I had to exclude Safari entirely via an @supports hack.

    I wasn’t entirely happy with that, so I refactored the layout to use a subgrid based approach with grid-template-areas. Since subgrid became Baseline Widely Available recently, the timing also worked out.

    While I was at it, I also restructured the HTML such that each cascade step is now a list item inside an ordered list, which gives better semantics.

  • Note - Posted on

    I built a visual explainer of the CSS Cascade, the algorithm that determines the “winning value” from a list of competing declarations.

    CSS cascade - visual explainer

    After Web Day Out 2026, I was checking out Manuel Matuzović’s UA+ stylesheet. Manuel mentioned that he wraps all rules in an anonymous layer to avoid specificity issues. I realised I didn’t actually understand how anonymous layers worked, so I went back and re-read Miriam Suzanne’s cascade layers guide on CSS-Tricks. I really liked the way Miriam presented the cascade and specifically the order of precedence within each step.

    Recently, while learning @scope, I had come across a diagram of the cascade in Bramus’ article on @scope. I had seen it before in his CSS Day 2022 talk as well but this time it stuck with me. The layout just made the cascade click visually.

    I wondered if I could combine Bramus’ cascade diagram layout with the order of precedence information from Miriam’s article. The early CodePen prototype turned out well enough that I decided to polish and publish it.

    There are still some things to be done. The website currently fails WCAG Success Criterion 1.4.4: Resize Text (Level AA) under certain conditions. I haven’t landed on a fix that works for the design yet. Hit me up if you have any ideas.

  • Note - Posted on

    I couldn’t make it to Web Day Out 2026. Thankfully, Jeremy wrote about it and linked to a bunch of online talk about it. Special shout out to Josh Tumath who live-blogged each talk.

    By all accounts, it was an excellent event. The regret at missing out (RAMO) is real. I remotely attended State of the Browser 2026 and I’d love it if more events offered a remote option.

    Many of the speakers were kind enough to share a link to their slides. I haven’t checked out all of them yet, but I liked Manuel Matuzović’s talk ‘Breaking with habits’. So much so that I feel the urge to redesign my portfolio based on the approach he showed. For now, I’ll dive deep into his UA+ stylesheet and oli.css project to get a deeper understanding.

  • Note - Posted on

    What happens when the var() CSS function references a custom property that is undefined or explicitly set to initial?

    In both cases the custom property’s value is the guaranteed-invalid value. That’s the initial value of every custom property as defined in the spec. When var() encounters this value during substitution, here’s what happens:

    1. If a fallback was provided, the fallback value is used.
    2. If no fallback was provided, the referencing property becomes invalid at computed-value time (IACVT). The property then behaves as if its value had been specified as the unset keyword.