Catch mouseup/mousedown events earlier in SelectionObserver
Listen for mouseup/mousedown events on the document body rather than document itself, so that we can still capture them if an event listener on `document.body` or `document.documentElement` stops propagation of the event. The VitalSource integration does this for example to prevent VitalSource's own selection UI appearing, but ordinary web pages could do something similar. In VitalSource books, this change makes the adder behave the same as it does in HTML and PDF documents where, when making a selection with the mouse, the adder only appears when the mouse is released so it doesn't get in the way during the selection. While updating the tests for this change, they were converted to use a real document, as the complexity of mocking the relevant parts of the DOM document interface accurately is now too high.
Showing
Please register or sign in to comment