Fix #13499: selector with leading ID matching only a name
(cherry picked from commit 5c4ab97a64c162503ac200bc7cea7f3e5725984d)