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

wrap

Controls whether a textarea's submitted value gets line breaks where the text wraps on screen (hard) or only where the user pressed Enter (soft, the default).

Overview

A <textarea> always wraps long lines on screen. The wrap attribute decides what is submitted. With soft, the default, the value contains only the line breaks the user typed. With hard, the browser also inserts a line break at every point where the text wrapped visually.

Applies to: <textarea> only.

Values

ValueOn screenSubmitted value
softWrapsOnly the user's own line breaks (the default).
hardWrapsA line break is added at each visual wrap point. Requires cols to be specified for conformance.
Absent, empty or unknownWrapsAs soft.
off (non-conforming)Doesn't wrap; scrolls sidewaysOnly the user's line breaks. Not in the HTML standard, though every browser supports it.

The added breaks are only in the submitted form data. textarea.value in script stays as typed.

Examples

When to use hard

Almost never. It suits a destination with a fixed line length, such as a plain-text email body or a printed label, where the server can't re-wrap. For anything shown in a browser, keep soft and let the display wrap the text.

No wrapping without wrap="off"

For code or log output where long lines should scroll instead of wrap, use CSS rather than the non-standard value.

This changes the display only; the submitted value is the same as with soft.

In Vanilla Breeze

  • Width. VB sets every textarea to inline-size: 100% (src/native-elements/input/styles.css), so cols does not set the visible width. With wrap="hard", breaks are inserted where the text wraps at the rendered width, which changes with the viewport. Checked in Chromium: a 400px-wide VB textarea broke a sentence after about 48 characters despite cols="20".
  • Height. data-grow makes a textarea grow with its content, starting from rows.
  • Counting. data-count counts the value as typed; breaks added by wrap="hard" are not counted and don't count toward maxlength.

Accessibility

  • wrap doesn't change what screen readers announce.
  • Sideways scrolling (wrap="off" or white-space: pre) is hard to use with a keyboard and at high zoom. Use it only where line structure matters, such as code.

Browser support

Chromium, Firefox and WebKit all insert the line breaks for wrap="hard" (checked November 2026 in Chromium 147, Firefox 157 and WebKit 26.4). soft and off work everywhere.

Gotchas

  • With hard, where the breaks fall depends on the font, the zoom level and, in VB, the viewport width. Don't rely on a fixed line length unless you also fix the textarea's width and font.
  • Leaving out cols doesn't turn hard into soft: the browser still wraps at the rendered width (default cols is 20). cols is required only for valid HTML.
  • Line breaks are submitted as CR LF (\r\n) whatever the wrap value.

Related

Which to choose

  • soft (default) — almost every textarea.
  • hard — the server needs pre-wrapped plain text and can't wrap it itself.
  • CSS white-space: pre — long lines should scroll on screen (code); the value is unchanged.
↑