You do not always need a spinner library to make a page feel responsive. Native HTML attributes and CSS properties can defer work, block accidental interaction, reveal progressive content, and keep the browser in charge of painting. The catch is that none of these features replaces real asynchronous state management. Use them where they fit, and keep a small fallback path for older browsers.

Quick comparison: native loading and interaction primitives
This table focuses on what each feature does well, not on pretending one attribute solves every loading pattern.
- loading: no JS; broad support; semantic media loading hint; best for below-the-fold images and iframes; fallback is just normal eager loading.
- inert: no JS for the attribute, with good modern support; removes elements from tab and accessibility-tree interaction; useful during pending overlays or disabled panes; fallback uses
aria-hidden,tabindex="-1", and pointer/focus blocking. - disabled: no JS and excellent support; native form-control semantics; best for submit buttons or invalid controls; fallback/enhancement needs
aria-disabledplus JS if the control is not natively disableable. - popover: no JS required for basic show/hide; top-layer light interaction; good for transient menus and confirmations; do not assume it provides a modal focus trap; fallback is hidden class plus checkbox or JS toggling.
- dialog: semantic dialog; modal behavior comes only from
showModal(), whileshow()is non-modal; good support in modern engines; fallback is a positioned div with focus management. - details/summary: no JS and broad support; native disclosure semantics; good for long content and optional sections; fallback is headings plus visible content.
- content-visibility: CSS-only rendering deferral; useful for long pages; support requires fallbacks; reserve size with
contain-intrinsic-size; unsupported browsers simply render normally.

Lazy media: use loading="lazy" where it is not critical
The loading attribute lets the browser delay images and iframes until they are near the viewport. It is the simplest perceived-performance win because you remove the decision-making from your bundle.
<img
src="comments.webp"
alt="Screenshot of the comment thread"
width="720"
height="420"
loading="lazy"
decoding="async"
>
Use it for article images below the first screen, avatar lists, product galleries farther down, and embedded iframes that are not immediately needed. Do not lazy-load the hero image, LCP image, or an iframe the user is expected to see immediately. Those should load eagerly, and the image should have width and height so the browser can reserve space.
No special fallback is necessary. Browsers that do not understand the attribute load the resource normally. If you want stricter control in very old browsers, a data-attribute plus JavaScript is the fallback, but that adds complexity and should be reserved for measurable cases.
Block interaction safely with inert and disabled
inert: freeze a container, not just a button
inert makes a subtree non-interactive: it is removed from tab order, text selection and clicks are suppressed, and assistive technologies avoid exposing interactive descendants. It is useful when a side panel is hidden, a wizard step is blocked, or a form area is temporarily unavailable.
<section id="checkout-form" inert aria-busy="true">
<h2>Payment details</h2>
<form>…</form>
</section>
A tiny feature-detection fallback can mimic the important parts. It is not identical to native behavior, especially for nested focusable elements, but it is a reasonable enhancement path.
if (!('inert' in HTMLElement.prototype)) {
const panel = document.querySelector('#checkout-form');
panel.setAttribute('aria-hidden', 'true');
panel.querySelectorAll('a,button,input,select,textarea,[tabindex]')
.forEach(el => el.setAttribute('tabindex', '-1'));
}
.is-inert-fallback {
pointer-events: none;
user-select: none;
}
Do not use inert merely to hide a spinner. Use it when users really should not interact with a section, and pair it with a visible reason or status message.
disabled: prefer native semantics for form controls
For submit buttons, disabled remains the first choice. It is keyboard-focus behavior varies by browser, but the control is announced as disabled and it will not submit the form.
<button type="submit" disabled>Save changes</button>
Progressive enhancement matters here. A disabled button on initial HTML can trap users if validation later fails without JavaScript. A safer pattern is to enable it through JS only when your enhanced validation runs, or use aria-disabled="true" on elements that are not natively disableable and handle the event explicitly.
button.addEventListener('click', (event) => {
if (button.getAttribute('aria-disabled') === 'true') {
event.preventDefault();
}
});
Popover and dialog: top layer is not the same as modal
popover for lightweight, transient UI
popover gives you top-layer presentation and built-in light-dismiss behavior without a component framework. It is good for action menus, inline confirmations, toasts, and small pickers. It does not promise an automatic focus trap, and it should not be described as a native modal dialog.
<button popovertarget="filters">Show filters</button>
<div id="filters" popover>
<h3>Refine results</h3>
<button popovertarget="filters" popovertargetaction="hide">Close</button>
</div>
For browsers without support, hide the content with CSS and expose a checkbox or class toggle.
[popover] {
display: none;
}
[popover]:popover-open {
display: block;
}
@supports not selector(:popover-open) {
.filters-fallback:not(.is-open) {
display: none;
}
}
dialog for real dialog semantics
<dialog> provides the semantics. The modal experience—backdrop, top-layer positioning, and the browser's modal focus behavior—depends on calling showModal(). Calling show() creates a non-modal dialog.
<dialog id="confirm">
<form method="dialog">
<p>Discard unsaved changes?</p>
<button value="cancel">Keep editing</button>
<button value="discard">Discard</button>
</form>
</dialog>
if (window.HTMLDialogElement) {
document.querySelector('#confirm').showModal();
} else {
// Fallback: show a positioned role="dialog" container,
// move focus inside, trap focus, and restore it on close.
}
If you cannot implement focus trapping and restoration in the fallback, do not claim the fallback is modal.
details and summary: native progressive disclosure
<details> is one of the most dependable no-JS loading-state tools. It keeps secondary content out of the way and lets users request it. It is especially useful for FAQs, advanced options, long comments, and reproducible build logs.
<details>
<summary>Show raw response</summary>
<pre><code>{ "status": "queued" }</code></pre>
</details>
It is not an accordion manager by itself; groups of independent details can all stay open unless you coordinate them. In old browsers, the content is usually visible, which is a perfectly acceptable degradation. If hidden content must remain hidden, add a CSS/JS toggle based on support.
content-visibility: skip rendering work the browser does not need yet
content-visibility: auto tells the browser it may skip rendering off-screen element contents until they get close. On long article pages, admin tables, chat histories, and documentation pages, this can reduce initial layout, painting, and style-recalculation work. The important companion property is contain-intrinsic-size, which reserves a placeholder size so scrollbar height does not jump wildly.
.lazy-section {
content-visibility: auto;
contain-intrinsic-size: auto 720px;
}
@supports not (content-visibility: auto) {
.lazy-section {
/* Safe fallback: let the browser render everything normally. */
}
}
<article class="lazy-section">
<h2>Quarterly report</h2>
<p>Hundreds of rows and charts live here…</p>
</article>
The auto 720px form remembers the last rendered size when supported and starts with a 720px estimate. Use logical chunk sizes: a section, a table page, or a message group. Avoid putting it on tiny cards or the main header; the overhead is pointless there.
The risks are real. Poor intrinsic-size estimates cause scrollbar jumps. Content inside skipped sections may not be ready for browser find or anchor scrolling in every situation, and sticky/positioned descendants can behave differently under containment. Test with a long page, keyboard search, in-page anchors, and real content heights.
Native skeleton screens: mostly CSS, progressive by nature
A skeleton is not a browser feature, but you can build one without JavaScript. Reserve the same layout the final content will occupy, then animate a restrained shimmer. Keep prefers-reduced-motion in mind.
<div class="skeleton-card" aria-hidden="true">
<div class="skeleton skeleton-title"></div>
<div class="skeleton skeleton-line"></div>
<div class="skeleton skeleton-line short"></div>
</div>
.skeleton {
border-radius: 8px;
background: linear-gradient(90deg, #e6e8ec 25%, #f5f6f8 37%, #e6e8ec 63%);
background-size: 400% 100%;
animation: shimmer 1.4s ease infinite;
}
.skeleton-title { height: 20px; width: 45%; }
.skeleton-line { height: 12px; margin-top: 12px; }
.short { width: 70%; }
@keyframes shimmer {
to { background-position: -400% 0; }
}
@media (prefers-reduced-motion: reduce) {
.skeleton { animation: none; }
}
If this represents real async data, the accessible status still belongs in HTML/ARIA, for example aria-busy="true" on the container and a polite role="status" message when content arrives.
Decision guide
Start with the cheapest native option. Lazy-load below-the-fold media, but never the key first-screen image. Use disabled and progressive enhancement for form buttons, and reach for inert when an whole region must be frozen. Use details for optional long content and content-visibility for expensive off-screen sections with reserved heights.
Choose popover for lightweight top-layer interaction and dialog plus showModal() when you genuinely need modal semantics. For actual fetching, retries, errors, timeouts, and completion announcements, JavaScript is still required—along with aria-busy and role="status". Native features remove unnecessary code; they do not remove the need to model state correctly.