setNodeMarkup replaces a leaf node outright, so the node selection maps off it: setting the wrap mode, resizing or rotating closed the frame's floating toolbar and the ribbon's contextual tab, which made picking a second mode take an extra click on the picture. frameAttrTr puts the selection back where it stood.