fix #367 movable dialog inside page with scrollbars

(cherry picked from commit ffb80efc0a154b1ed49829065e84f140a286f5e8)