Frontend news from March 7, 2025

Breaking Change

Quantity component better accesibility (via Deferred Template Updates)

Adjustments in 3G Templates

HTML Structure Adjustments in the Quantity Component

<span class="quantity">
    <span class="increase-tooltip js-increase-tooltip" data-trigger="manual" data-container="body" data-original-title="Není možné zakoupit více než 9999 ks." aria-hidden="true" role="tooltip">
    </span>
    <span class="decrease-tooltip js-decrease-tooltip" data-trigger="manual" data-container="body" data-original-title="Minimální množství, které lze zakoupit, je 3 ks." aria-hidden="true" role="tooltip">
    </span>
    <label>
        <input type="number" name="amount" value="3" class="amount" autocomplete="off" data-decimals="0" step="1" min="3" max="9999" aria-label="Množství">
    </label>
    <button class="increase" type="button" aria-label="Zvýšit množství o 1">
        <span class="increase__sign">+</span>
    </button>
    <button class="decrease" type="button" aria-label="Snížit množství o 1">
        <span class="decrease__sign">−</span>
    </button>
</span>

Component with aria-live Region for Screen Readers

<div id="screen-reader-announcer" aria-live="polite" class="sr-only"></div>

CSS Adjustments

JavaScript Adjustments

Behavior Update for increase and decrease Buttons

New Function: shoptet.helpers.announceToScreenReader

announceToScreenReader(message, liveType = 'polite')
@param {string} message - The message that will be announced by the screen reader.
@param {'polite' | 'assertive'} [liveType="polite"] - Defines the urgency of the announcement:
    polite (default): Announces the message at the next available opportunity.
    assertive: Announces the message immediately, interrupting any ongoing speech.

Adjustments in 2G Templates


Improvements

Deprecated function log

As we informed you in the previous news, we will mark deprecated functions using shoptet.dev.deprecated and log them into the console. Please remove deprecated functions from your codebase as soon as possible.

Largest Contentful Paint (LCP) metrics improvement

We moved cookie bar right after the footer element, this significantly improves the performance.


What we plan in upcoming days

Post navigation