Currently, if none of the preferred positions fit in the viewport, the ConnectedPositionStrategy will simply apply the first preferred position. The next step in its implementation would be to keep track of how far each position is from fitting in the viewport, and apply the "best fit" position if none of them fit.
cc: @jelbourn