- Docs
- Accessibility and motion
Accessibility and motion
What @samline/reveal guarantees for reduced motion, printing, screen readers and keyboard users, and what your page still provides.
Responsibilities
Reveal only decides when an element animates in; the stylesheet does the animation. It guarantees that content is never hidden when it should be readable: elements already in view on load are never hidden, and every element is visible without JavaScript, without IntersectionObserver, with reduced motion and when printing. It does not change roles, labels or the tab order.
Motion and state
- With
prefers-reduced-motion: reducenothing is hidden or animated, and scrub mode shows the element as is. - Prefer motion-free content?
data-reveal-reduced="fade"(orreducedMotion: 'fade') keeps elements hidden until they enter under reduced motion, but only their opacity transitions: no movement, scale, rotation, blur or wipe. The default,show, shows everything at once. Pages heavy on decorative reveals read better withreducedMotion: 'fade': content still arrives gently instead of all at once. Printing always shows everything. hide()never hides an element that is shown as is (reduced motion in the defaultshowmode, or a media query that does not match), so those stay visible whatever your code calls.data-reveal-media(ormedia) shows an element as is, never hidden, while its media query does not match. Use it to skip animation on small screens.- Hidden elements use opacity and the individual
translate,scale,rotateandfilterproperties, neverdisplayorvisibility, so the page layout does not jump when they appear. data-reveal-repeathides an element again when it leaves the viewport. Use it for decoration, not for text people need to read twice.
Screen readers and keyboard
An element waiting below the fold is transparent but still in the accessibility tree, so screen readers read it and links inside it stay in the tab order. When keyboard focus moves into one, the browser scrolls it into view and it is revealed. Do not combine reveal with aria-hidden or inert on content that matters.
Split text
With data-reveal-split, the visible words or characters are wrapped in a span with aria-hidden="true", and a visually hidden sibling (data-reveal-split-text) holds the element’s original text, so assistive tech reads the sentence as one piece instead of letter by letter. Elements containing links, buttons, images or other interactive content are never split, so focus, tab order and alternative text are untouched, and the copy turns a line break into a space. With reduced motion the pieces follow the same rules as any element: shown at once, or only fading with data-reveal-reduced="fade". Printing shows everything. Splitting puts words in separate boxes, which some browsers read with a pause; use it on short headings, not long paragraphs.
Layout and contrast
Keep effects subtle: short distances, fade or up, and durations around the default 600 ms. blur and large zoom values are harder on visitors sensitive to motion. Contrast is checked on the final state; while revealing, text is briefly lighter.