renaming queries renames it's menu item

https://community.openproject.org/work_packages/16720
Maybe a doc-string explaining this function would help. Its not entirely clear (at least to me) that this function takes a title and returns a menu item which has a title alphabetically preceding the given title-- but only until some element with a `type` class appears. :)