The current text_with_summary widget adds the “Edit summary” button with JavaScript and appends it inside the Body label. Activating it moves the control and replaces it.

This example deliberately loses focus

The Before behaviour is the defect: after you activate the toggle, focus falls to the page body and the button is a different element. Use reset (reload) to start again. The rest of the page does not move.

What to check

Next: the persistent disclosure.