AI 摘要This article benchmarks JPEG XL (via libjxl and the newer jixel encoder) against AVIF across web use-cases, including lossy photos, screenshots, illustrations, transparency, HDR, and lossless images. It concludes that AVIF almost always produces smaller files and encodes/decodes faster, making it the better default for lossy web images, while JPEG XL only clearly wins for lossless compression and lossless JPEG recompression. The author recommends defaulting to AVIF 4:4:4 at high effort, but checking JPEG XL via jixel when AVIF produces an unusually large file.
AI 摘要The article explains that the timing of when CSS custom property values are computed depends on whether they are registered with @property: unregistered properties store values as token streams and only fully compute where they are used via var(), while registered properties with a specific syntax compute earlier, at the element where they are defined. This distinction changes the outcome for functions like sibling-index(), relative font and container query units, and URL resolution. It also notes that arbitrary substitution functions like var() are always substituted regardless of the registered syntax, which can cause nested values like a child's --multiplier to be ignored.
AI 摘要The author describes an accessibility mistake made while creating a toolbar tooltip: after removing the button's aria-label to stop VoiceOver from announcing 'Bold' twice, the button was left without an accessible name, since aria-describedby only provides supplementary description rather than a name. Accessibility experts from TetraLogical pointed out the error, and the fix was to switch to aria-labelledby, which supplies the accessible name from the tooltip content. The key lessons are to always ensure interactive elements have an accessible name and to test with multiple screen readers, since results vary across tools.
AI 摘要The article explores CSS techniques for achieving ideal sizing of customizable pickers, addressing problems where the picker hits the viewport edge or becomes unusably small when dragged to the screen boundary. The author uses margins with @supports fallbacks for Firefox, flip-block/flip-inline position-try fallbacks to keep margins correct when the picker flips in Chrome and Safari, and calc-size() with fit-content to set a minimum height that doesn't affect small pickers. The key insight—that calc-size() enables minimum sizes like min(fit-content, 12em)—came from Ian Kilpatrick, with a hacky :has() selector fallback provided for browsers lacking calc-size() support.
AI 摘要JSON module imports are now supported across all major browsers, but the author argues they shouldn't be used as a blanket replacement for fetch() in browser environments. Imported modules are cached for the lifetime of the page and failures take down the entire module graph with limited error introspection, risking memory leaks when dynamically importing data like API responses. JSON module imports are best suited for local static resources bundled at build time, while fetch() remains preferable for runtime fetching due to its superior garbage collection and error handling.
AI 摘要The article surveys the current state of progressive image rendering in browsers across JPEG, PNG, WebP, AVIF, and JPEG XL, comparing when partial renders appear, decoding costs, and each format's limitations—concluding that browser support is inconsistent (e.g., Safari lacks WebP and JPEG XL progressive rendering, and AVIF's experimental layered mode has quirks). The author argues that progressive rendering's real-world benefit is limited because data typically arrives in bursts rather than gradually, making it a nice-to-have rather than a replacement for careful image sizing. He also explains why using progressive decoding to replace responsive images is impractical due to network lag, and notes promising but not-yet-browser-ready progressiveness in JPEG XL encoders and third-party decoders.
AI 摘要The article explains that while fetch request and response streams are useful for processing data incrementally, they are unreliable for measuring upload/download progress: download measurements break when Content-Encoding compresses responses, and request streams only measure when chunks leave your stream, not when they actually reach the server. The author warns that using streams for upload progress could even pressure browsers to avoid performance-improving buffering changes. For now, developers needing progress events should use XHR, though a future fetch observer API is being proposed to add proper upload and download progress support.
AI 摘要The article explains that XSLT, the roughly 25-year-old XML transformation language natively supported by browsers, is barely used, a frequent source of security issues, and slated for removal from Chrome, Safari, and Firefox. The author covers alternatives such as styling XML directly with CSS, converting to HTML on the server or in a build process (recommended in most cases), or transforming XML client-side with JavaScript by swapping the XML root for an HTML root. A key gotcha is using createElementNS with the XHTML namespace to create real HTML elements in XML documents, ensuring proper semantics, accessibility, and behaviour.
AI 摘要The author argues that footnotes are a poor UX pattern inherited from the limitations of print media, and that replicating them on the web—with tiny link targets, disruptive scrolling, and disorienting navigation—makes the reading experience even worse. They instead recommend keeping supplementary content in the reader's flow through parentheses, styled note sections, or animated elements, allowing readers to easily decide whether to engage with or skip the extra content. While acknowledging exceptions like Wikipedia's reference footnotes, the author concludes that footnotes should generally be abandoned on the web.
AI 摘要The article explains why zoom animations using the CSS transform order `scale() translate()` produce an odd 'swooping' effect: during interpolation, the growing scale value acts as a multiplier on the translate values, making the movement non-linear. The fix is to put translate first with values pre-multiplied by the scale (or use the separate `translate` and `scale` properties), although incidentally, adding a `rotate(0)` to the start transform also 'fixes' the animation by forcing the browser to interpolate matrices. The author also compares scale-based zooming to a 3D perspective translate approach, noting the latter feels more like an object moving toward the camera.