0056. Morphs and the back gesture ride on the screen transition
- Status: Accepted (Mik, 17 Nov 2026)
- Date: 2026-11-14
- Decided by: integrator (internal only), pending Mik's approval
- Planning item: none (WP12)
Context
Decision 0032 made transitions kinds that each target plays its own way, and left morphs (the glossary's "an element carried from one screen to another") and gestures for later. Apps expect a thumbnail to grow into the picture it opens, and expect to go back by swiping from the edge with the screen under the finger.
Decision
Morph. morph="name" (or morph={...}) names an element. When the screen being left and the screen arriving each have an element with the same name, it travels from the first's place and size to the second's during the transition, whatever its kind; the screens still slide or fade as their kind says.
- On the web with the View Transitions API, the browser plays it: only the named elements are captured (the root's
view-transition-nameisnonewhile it runs), so the screen stack's own movement plays live beneath them, and the screens start moving once the arriving one has been captured at rest. - Without it, a copy of the arriving element flies from the old place to the new (FLIP), with both originals hidden until it lands.
- A navigation during a morph finishes it at once. Reduced motion has no morph. Morphs work for push and pop alike, since the screen gone back to is kept (decision 0031).
Back gesture. On touch (or a pen), a swipe that starts within 20 px of the leading edge (the left one, or the right one where the screen is right to left, dir="rtl"), while the screen in front has a kept screen behind it in the same outlet, moves the screens with the finger: the front one follows, the one behind slides out from under it. Released past 35% of the width, or flicked, it goes back, and the pop transition carries on from where the finger left the screens. Released sooner, both slide back; a transition or a new swipe that starts while they do takes the screens from where they are. With reduced motion, a swipe released early puts the screens straight back, and one that goes back fades the front screen out where the finger left it instead of sliding it on. The screens follow the finger either way, since that movement is the person's own. Right to left, every movement is mirrored: the swipe goes leftwards, the front screen leaves by the left and the screen behind comes in from the right, and so does the pop that finishes it. A tap at the edge stays a tap (8 px slop), a mouse is ignored, and screens set touch-action: pan-y pinch-zoom so the browser leaves sideways moves to the gesture while horizontal scrollers inside a screen still scroll.
Native (updated): morphs are built in the engine adapter (packages/engine/src/morph.tsx), not with each platform's shared-element transition, which Lynx does not expose. When a movement starts, each morph name both screens draw is a pair; both are measured on their own screen with Lynx's boundingClientRect, and a copy of the arriving element (its classes, its look and, for an image, its picture) is drawn above both screens where it lands, moved and scaled back to where the leaving one was (FLIP), then let go with a transform transition of the web's length and easing. Both originals are hidden until it lands. With reduced motion nothing flies, and a new movement finishes the one before at once. E0212 is no longer reported. A view, button, text or image carries a morph: the copy is the element's box, with a text's words, a button's content and an image's picture in its own fit; a view's copy is its box alone. Any other element with a morph, and a morph in a layout or in a component a layout places (drawn outside every screen), is E0453, since it would never move. The stack lets the leaving screen go only once every copy has landed, so a fade shorter than the flight never cuts it off; measuring gives up after 200 ms; a new movement takes away the copies of the one before in the same drawing; and only the elements whose hiding changes are drawn again. The interactive back gesture stays the platform's own (iOS edge swipe; Android's back, sent into the bundle). Lynx for Web tests the flight (packages/engine/test/native-morph-in-browser.test.ts); its feel on a phone is a device check.
Alternatives considered
| Option | Why not |
|---|---|
| View Transitions for the whole document | Decision 0032's reasons stand: snapshots of the whole page fight the kept screens of the stack |
| Only the FLIP copy | The browser's morph crossfades the old and new looks and is cheaper; the copy remains the fallback |
| An edge strip element that catches touches | It intercepted clicks on anything within 20 px of the edge, for mice too |
| The left edge whatever the direction | Right to left apps go back from the right edge, and their screens arrive from the left |
Consequences
The screen stack's swap is split into attaching the arriving screen and playing the transition, so a morph can run between them. The router installs the gesture; router-transition.ts takes the gesture's progress when it plays a pop.