Using the Popup sample, if you put any top/left margin at all on the viewDiv, the click target is offset by a corresponding amount (easier to see if you switch to displaying Point symbols). For example, if you have a 20px left margin, you have to click 20px to the right of where the symbol is displayed on the map. Similarly for any top margin (or other positioning). Right/Bottom margins do not seem to affect anything.
I think something in the API is making an assumption that the map will always be flush with the top left of the browser window, or possibly that it might be applying the offset twice, since you have to click in the opposite direction of where the feature/graphic would be located if the margin did not exist.