Selectmenu: Preserve text selection when interacting with the widget

Fixes #10144
Closes gh-1295