Please note: I’m using borders in the example in order to visualize the problem, even if they maybe add to the problem, they are not the root cause of it.
Browsers
The behavior does not seem to be browser specific, as I’ve tested with Firefox 3.6, IE 8 and Chrome, with same result.
I’ve also attached a project that demonstrate the behavior.
The padding needs to be there so that the wrapper can apply borders around the element when something is dragged over it (if it accepts drags). Negative margins would be more flexible, but since core Vaadin layouts are what they are (i.e. clip all layout cell contents), margins and outlines are not an option.
The workaround to remove the padding is what you’ve done, use a custom theme and override the padding.
I see your point. When I removed the padding, the hints started making the child component jump back and forth.
This might be related to how layouts in general work in Vaadin, but shouldn’t one expect the child of a component (with defined size) to have the parents size - padding. Like this:
That would be expected. But the issue is not directly related to layouts, instead it depends on the CustomComponent and its client-side counterpart VCustomComponent, which are used as the basis for the DragAndDropWrapper.
The way the VCustomComponent calculates the allocated space for its child component (composition root) does not take the elements padding into account, it just uses plain offsetWidth/offsetHeight to calculate relative sizes for the contained component.