Vanilla Breeze v0.7.4

Vanilla Breeze v0.7.4 released

0.7.4 gives the Ambient pack weather. A page names one feed URL on its own site, and the pack sets data-weather from it, uses its sunrise and sunset for dawn and dusk, and never shows a stale observation. Helpers for producing the feed from Open-Meteo are included. Ambient p…

Read the release notes

Debugging

What to check when a page does not look or behave as expected: styles, layouts, components, themes and build tools, each as a symptom with its causes and fixes.

Start here

Most problems are one of three things. Check them in the browser's developer tools before reading further.

  1. The stylesheet did not load. In the Network panel, look for vanilla-breeze.css with status 200.
  2. The script did not load, or stopped. Look for vanilla-breeze.js in the Network panel and for errors in the Console. The script tag needs type="module".
  3. An attribute is misspelled or has a value the library does not know. Attribute selectors fail without a message. Compare the markup with the element's or attribute's reference page.

Debug mode

The development add-on has three aids. Each is an attribute you add while you look for a problem and remove afterwards.

Attribute Goes on Shows
data-debug <html> A dashed red outline on any <layout-card> with more than one <header> or <footer>, or with its header, section and footer out of order. The reason appears when you point at the card, and as a warning in the Console
data-show-grid Any element Twelve column guides over that element
data-show-spacing Any element An outline around every element inside it

Debug mode can also be turned on for every page of a site from the Console. It stays on until you remove the entry.

The check covers the card's structure only. For markup in general, use an HTML validator.

Styles

The page is unstyled

  • The stylesheet request failed. Check the path in the Network panel. From npm the import is vanilla-breeze/css.
  • A bundler or a content security policy blocked the file. The Console says which.

A token has no effect

  • The name is wrong. Spacing tokens are --size-*, and sizes are s, m and l, not sm, md and lg: --font-size-s, --radius-m, --size-l. A var() with an unknown name fails silently. The Tokens reference has every name.
  • You set a brand color on one region and links or buttons there kept the page's color. Tokens computed from other tokens are computed where they are declared. How a token change reaches an element explains the fix.

Your rule does not win

  • Your rule is inside an @layer. Every library rule is in a layer, and a rule outside any layer beats them all, whatever its specificity or the order of the stylesheets. Take your rule out of the layer.
  • The library marked that declaration !important on purpose. The hidden attribute is one: [hidden] is always display: none, so show the element by removing the attribute, not by setting display.

Overrides lists the layers and the exceptions.

Styles differ after a build

  • A tool that removes unused CSS dropped rules for custom elements or data-* attributes it did not find in your templates. Exclude the Vanilla Breeze stylesheet from it.
  • A CSS transform with an old browser target rewrote @layer, nesting or light-dark(). Leave the library's stylesheet as it is shipped. It is already minified.

Layouts

A layout does nothing

Layouts are CSS only, so the script is not the cause. Select the element in the Elements panel: its computed display should be flex or grid. If it is, the layout is working and a modifier is wrong.

Gap values are none and 3xs to 3xl. The data-layout reference lists every modifier.

A grid shows one column

A grid makes as many columns as fit, each at least the minimum width: 15rem by default, or 8, 10, 15, 20 or 25rem for data-layout-min values xs, s, m, l and xl. If the grid's own width is less than two of those plus the gap, one column is correct. Lower the minimum, or check why the grid is narrow.

A section or article has no width

The library makes <main>, <article>, <section> and <aside> query containers, and a container takes its width from its parent. In a flex or grid row of your own that sizes children by their content, such a child shrinks to nothing. Give it a width, or set container-type: normal on it. The library's own layouts handle this: see where a sectioning element is not a container.

Components

A component does not respond

  • The script is missing or failed. See Start here.
  • The element is not registered. In the Console, customElements.get('tab-set') returns a class when it is and undefined when it is not. With the core bundle, the component may be one that bundle leaves out. The bundle configurator lists the bundles.
  • The markup inside is not what the component expects. Compare it with the first example on the component's page.

Until a component's script runs, its content is plain HTML. An <accordion-wc> is a list of working <details> elements either way.

Nothing animates

The system is set to reduce motion. The library's durations go to zero under that setting. Preferences explains the rule, and Testing shows how to switch the setting in developer tools.

An icon is missing

<icon-wc> fetches one SVG file per icon. When the fetch fails, the element gets data-error="true" and the Console shows a warning that starts icon-wc:.

  • The name is not in the set. Names are the Lucide names unless the page sets another icon set.
  • The files are not where the component looks. It asks the folder icons/ beside the script it was loaded from. If you copied the script without that folder, copy the folder too, or set data-icon-path on <html> to where the icons are.

A <drop-down> flips to the opposite side when it would run off the viewport. Set position to bottom-start, bottom-end, top-start or top-end for the side you prefer, and add no-flip to keep it there.

Themes and modes

A theme name has no effect

The theme's stylesheet is not on the page. Modern, Minimal, Classic and the accessibility themes are in the main stylesheet. Every other theme is its own file. See Using themes.

The page shows a different theme or mode from the markup

A choice the visitor made earlier, with a <theme-picker> or a <settings-panel>, is stored in the browser and replaces the page's data-theme and data-mode. To see the page as authored, clear the choice from the Console.

If the site should always use its own theme, add data-theme-source="site" to <html>. Using themes covers it.

Dark mode does not follow the system

With no data-mode on <html>, the page follows the system setting with no script. If it does not, look at <html> in the Elements panel: data-mode="light" or data-mode="dark" is there, written in the markup or by a stored choice. Dark mode is data-mode, not a theme name.

Your colors are wrong in dark mode

A fixed color in your own CSS does not change with the mode. Use a semantic token, or give the color two values. Your own colors in both modes shows how.

A theme choice is not remembered

The choice is saved in localStorage under the key vb:theme:current. A private window, or a browser set to block site data, does not keep it.

Build tools and servers

An import cannot be resolved

Install the package and import it by its public names. A path into the package's folders is not exported and fails in a bundler.

Server-rendered pages

  • Layout elements and native elements need the stylesheet only, so they are styled in the first response.
  • Components upgrade in the browser. Import the script from code that runs in the browser, not on the server.
  • The integration guides have the setup for Astro and Eleventy.

Browser support

The library is written for current browsers and ships no polyfills for CSS. If a page looks broken in one browser only, check that the browser supports each of these features. The compatibility table on each feature's MDN page lists the first version with support.

Feature Used for
@layerEvery rule
OKLCH colorsEvery color token
:has()Many element rules
Container queriesLayouts that follow their container
CSS nestingEvery stylesheet
Relative colorsHover, active and subtle shades
light-dark()Light and dark values of each color
PopoverMenus, tooltips and popovers
@scopeRules limited to one component or region

Anchor positioning, which places menus and tooltips beside their trigger, has a script fallback where the browser lacks it.

If you are still stuck

  1. Reduce the problem to the smallest page that shows it: the two files from Start here and the markup at fault.
  2. Search the issues on GitHub.
  3. Open an issue with that page, the browser and its version, what you expected and what happened.
↑