Remove and restore selection for non-isolated dialogs

In non-isolated mode the only way to prevent accidental typing in
the document is by removing the native selection, so do this.

This unavoidably sets the model selection to null, so when the dialog
closes, restore the selection if it hasn't been already by an action.

Bug: 73097
Change-Id: I93f741734ff3d46397c1278c500ae3c124a3a14f
(cherry picked from commit 6be79d9ae7bc728ee1d80e82c53511a9d1da6176)