Fixes #17339. Fix messed up layout of the panels of the slot which happens in some conditions as side-effect of the fix of #16996
(cherry picked from commit 14cbcd8f01414cab97d421594979c5effb5d4931)