Fix item highlighting issues in dropdown list.

This fixes #8359 and #8374.