pointer-events:none
set.
As the chain reaction only stops once a background object
(any object with class background) is hit, and the SVG
itself cannot respond to mouse events, this method requires the
existence of a background object beneath all the other
objects (most easily done with a rect
encompassing the
entire SVG). This may make its use with external SVGs a little
cumbersome.
The entire chain reaction should resolve immediately on click, but depending on the browser (and even on the same browser for different sessions), the reaction may stop partway. Under most circumstances this should cause no problems, and once the user begins navigation with the mousewheel or moves their mouse a little, the reaction will complete. The rare case where this is known to cause problems is if the click occured just outside the boundary of another object, and upon click, the user moves their mouse onto this object. This will lead to the relative depths of the selected objects being incorrect for navigation.
If the depth of the overlapping objects is large, resolving the entire chain reaction (especially if all done immediately on click) can be computationally demanding.
All mousewheel events occuring when the mouse is inside the SVG are captured and default action (i.e. scrolling) is prevented. This is by intent, but the code can be adjusted so that scrolling is not prevented under some conditions, should that be desired.