Fixes text search and selected for "secured" documents (take 2)

... using CSS visibility attributes. Fixes #2663.

@vyv03354, can you review?