Panel: Panel classes set on wrong page

Closes gh-6920
Fixes gh-6650