I've run into a problem with nested widgets and raycasts. In many of our scenes, we have widgets with collisions on them nested below other widgets with collisions on them. In these cases, the widget that gets button events is unpredictable.
Looking at the code, CalculateRaycastDepth (I'm currently on 3.0.2 which has CalculateSortingDepth) uses GetComponentsInChildren<UIWidget> to collect all widgets beneath the GameObject that was collided with. 3.0.2 returns the Max depth of any of those widgets, 3.0.5 returns the Min depth. Neither seem like the correct way to go in all cases.
If the collision being considered is actually on a widget, I think you'd want that widget's depth. It gets really complicated if a non-widget attached collision has collisions on children.
I added:
UIWidget w = go.GetComponent<UIWidget>();
if(w != null)
{
return(w.sortingDepth + 1);
}