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