widget: fix widget insertion with or without canvas.before. closes #1021.