Fixing a bug when triggering the selectItem method on a select containing optgroups