Different fix for #11152 which is restricted to the problematic case in horizontal layout

Change-Id: I4727f0a8f0b82f14f059c7e47a1819a18630a4c0