Back to Plate

Shell promotion must move selection into the promoted island or it is just cosmetic

docs/solutions/performance-issues/2026-04-11-shell-promotion-must-move-selection-into-the-promoted-island-or-it-is-just-cosmetic.md

53.0.62.1 KB
Original Source

Shell promotion must move selection into the promoted island or it is just cosmetic

Problem

Promoting a shell is not enough.

If the runtime only removes the shell wrapper but keeps selection at the old active island, the user still is not editing where they clicked.

That is a fake corridor.

Symptoms

  • shell disappeared on mouse down
  • mounted descendant count changed
  • but the model selection stayed at the old default live island unless another path moved it later

What Didn't Work

  • treating shell promotion as purely visual state
  • assuming browser focus alone would retarget editing correctly after promotion
  • measuring shell disappearance without measuring “promote then type”

Solution

On shell mouse down:

  • promote the island
  • select the start of the promoted top-level island in the model
  • focus the real editor root

Kept files:

Then prove it in both places:

  • runtime test: promoted shell lands selection in the promoted island
  • browser bench: add promoteTypeMs

Why This Works

The active corridor has to become the place where model selection lives.

Once shell promotion also moves selection:

  • DOM selection sync retries against the newly mounted island
  • typing goes into the promoted island instead of the old live island
  • promotion becomes a real editing transition, not a cosmetic rerender

Prevention

  • never treat shell disappearance as proof of usable editing
  • benchmark promote then type, not just promote
  • if corridor entry does not move model selection, it is not a corridor