implement function to collapse widgets, fix #12