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

Direction

How right-to-left layout works: the dir attribute, logical properties, the parts that mirror and text of mixed direction.

The dir attribute

Arabic, Hebrew, Persian and Urdu are written right to left. Set dir="rtl" on <html>, or on one element for a passage, and the layout follows. The demo changes that one attribute and nothing else. The text stays in English so you can compare the two.

lang does not set direction. Set both. Direction belongs in the markup and not in CSS, because the browser's text algorithm and assistive technology read the attribute.

Logical properties

The library's styles name the start and end of a line, never left and right. Start is the left edge in English and the right edge in Arabic, so the same rule is correct in both.

Write your own CSS the same way and it mirrors with the rest. The layout elements, such as <layout-sidebar> and <layout-cluster>, are built on flexbox and grid, which follow the direction without any extra rule.

What mirrors

Some parts need more than logical properties, because they point somewhere. The library flips these with :dir(rtl).

PartIn right-to-left
Breadcrumb separators, list arrow markers, disclosure markersPoint the other way
Switches, range inputs, progress barsFill from the right
Blockquote and callout borders, sidebarsMove to the other edge
Carousels, reels and slidersAdvance from right to left
Arrow keys in tabs, carousels, sliders, steppers and splittersLeft Arrow moves forward and Right Arrow moves back

Some things must not mirror: a clock, a media player's play button, a chart's time axis, and any icon that shows a real object. The library leaves those alone.

Text of mixed direction

A user name, a product title or a search term can be in any script. Dropped into a sentence of the other direction, its punctuation and numbers can end up on the wrong side. Wrap text of unknown direction in <bdi>, which isolates it from its surroundings.

For a form field that may be typed in either direction, dir="auto" sets the direction from the first strong character, and dirname sends the direction to the server with the value.

Direction in script

isRTL() answers whether a language is written right to left, from its tag.

In CSS, select on direction with :dir(rtl). It matches inherited direction, which [dir="rtl"] does not.

↑