← Back to Guide

Selected Text test

Remove selection

Monocle needs custom events for "text has been selected" and "text has been deselected". (These events could form the basis of annotations or selection context menus, perhaps.)

Custom events are working here if the yellow box appears and displays selected text from the iframe, then disappears when text in the iframe is deselected.

Furthermore, as soon as a page begins turning, any selected text should be deselected. This is trivial in most browsers — window.getSelection().removeAllRanges() — but bizarrely difficult in MobileSafari.

The Remove Selection button is wired to take effect on a tap or a swipe, on touch-based and cursor-based browsers. The best test is to drag from inside to outside the button — text in the frame should be deselected.