Fix inconsistency between demo and displayed code for modal demo

Fixes #13991