FIX: prevents extreme cases to overflow in selected content (PR #14339)

It would for example cause an issue for a lot of selected items with long names.

GitHub

@pmusaraj feel free to merge