I use FieldSets to structure certain parts of the UI. When a FieldSet is set to full width, and the surrounding layout has no padding, the FieldSet becomes to wide for the browser window.
FieldSet fs = new FieldSet("My Fieldset", new Span("Some content"));
fs.setWidthFull();
VerticalLayout layout = new VerticalLayout(fs);
layout.setSizeFull();
layout.setPadding(false);
FieldSet is just the native html <fieldset> element, without any Vaadin-specific css, and I think browsers give it a small margin by default.
Width does not include the margin of an element, so the horizontal space an element takes is the width + the horizontal margins. Setting 100% width on an element with horizontal margins means that the width is 100% of the container, but then the margins add on top of that, making it a bit wider than the container.
So the workaround is to remove the margin from the FieldSet, with inline styles, a utility class, or in a stylesheet.
It seems that it’s not the margin, but the padding (more precisely padding-inline) of the FieldSet. If I remove this, the total width is fine, but then the content moves close to the border and the label also is way too left. :-/