fixes #5578 Widget toggle editor does remember it state

Fixed the issue and pushed the code for review, please check it.