Fix bug in ControlbarComponent and clean up the code [Finishes #78737770]