Glossary · Usability & UX

Scroll trapping

In short

Scroll trapping happens when an embedded 3D model captures mouse-wheel or swipe movements for zoom and rotation, so the page can no longer be scrolled over it. On phones, where the model fills the screen, users get stuck.

Where it comes from

3D viewers use the mouse wheel to zoom and swipes to rotate. To do so they call preventDefault() on wheel or touch events so the page does not scroll as well. MDN notes that registering the listener with passive: true may cause the browser to generate non-cancelable wheel events [1]. On touch devices, the CSS property touch-action controls which movements the browser handles itself [2]. With none, every swipe over the model belongs to the model.

Patterns that help

PatternHowTrade-off
Zoom with a modifierthe wheel scrolls the page; zoom with Ctrl/Cmd or buttonsneeds a hint
Click to activatethe model reacts only after a click or tapone extra step
Release vertical swipestouch-action: pan-y: vertical scrolls the page, horizontal turns the modelswipe rotates only about the vertical axis
Leave marginsmodel not full-screen, scroll area beside itless room for the model
Full screen on requestsmall preview, full screen via a buttonextra step

overscroll-behavior stops a scroll area from dragging the page behind it once it hits its end (scroll chaining), but MDN notes that an iframe is not a scroll container [3]. For embedded configurators the behaviour must be solved inside the iframe itself.

The keyboard too

The same problem exists with the keyboard: WCAG 2.1.2 requires that focus moved into a component with the keyboard can also be moved away with the keyboard; if that takes more than arrow or Tab keys, the method must be explained [4]. A 3D area that uses arrow keys to rotate must not hold on to focus.

How to test

Scroll the page from top to bottom on a real phone without deliberately touching the model. Can you get past it without a detour? Then it is solved. See also door, gate and window configurator implementation on phones and loading.

Related terms

  • Touch gestures in a 3D viewer

    Touch gestures are the finger movements used to work a 3D model on phones and tablets: drag with one finger to rotate, pinch with two to zoom, tap to select. Every gesture should also have a simple alternative.

  • Embedding with an iframe

    Embedding with an iframe runs the configurator as its own document inside your page. The two sides exchange data such as the finished configuration safely via postMessage, and loading="lazy" defers the frame until it comes near the viewport.

  • Onboarding hint

    An onboarding hint is a short overlay that shows, on the first visit, how to use a 3D model – for example "drag to rotate". Good hints are brief, sit where the action happens and disappear as soon as the user acts.

  • Keyboard operation

    Keyboard operation means every function of a configurator works from the keyboard without a mouse (WCAG 2.1.1, Level A), and focus can always leave a component again (2.1.2). For the 3D model, view buttons help where dragging would otherwise be the only way.

  • WCAG (Web Content Accessibility Guidelines)

    WCAG (Web Content Accessibility Guidelines) are the W3C guidelines for accessible web content. The current version, WCAG 2.2, is published as the W3C Recommendation of 12 December 2024 and assigns its success criteria to levels A, AA and AAA.

More in our guides

Sources

  1. MDN Web Docs: Element: wheel event
  2. MDN Web Docs: touch-action
  3. MDN Web Docs: overscroll-behavior
  4. W3C: Understanding Success Criterion 2.1.2 No Keyboard Trap

← All terms in the glossary