-
Notifications
You must be signed in to change notification settings - Fork 93
Description
Describe the bug
When using the Aura theme (either via @Stylesheet(Aura.STYLESHEET) or dynamically via addStyleSheet()), the Grid component loses vertical scrolling capability. The grid
expands to its full content height instead of constraining to the allocated space and scrolling internally.
The Lumo theme provides shadow DOM styles for the grid's #scroller element that constrain it to the grid bounds:
/* Lumo grid styles (vaadin-lumo-styles/src/components/grid.css) */
#scroller {
position: absolute;
inset: 0;
min-height: 100%;
height: auto;
width: auto;
}
The base styles used by Aura have a different definition:
/* Base grid styles (grid/src/styles/vaadin-grid-base-styles.js) */
#scroller {
position: relative;
overflow: hidden;
}
With position: relative, the #scroller expands with its content. With position: absolute; inset: 0, it is constrained to the grid host's bounds, allowing #table (overflow:
auto) to scroll.
The Aura theme (@vaadin/aura/src/components/grid.css) does not provide shadow DOM overrides for #scroller, so it relies on the base styles which lack the absolute
positioning.
The issue occurs specifically with horizontal SplitLayout (default orientation). Vertical SplitLayout works correctly because flex-direction is column and the grid
height is controlled by flex along the main axis.
Workaround
Inject the Lumo-equivalent #scroller styles into the grid's shadow DOM:
grid.getElement().executeJs(
"const s = new CSSStyleSheet();" +
"s.replaceSync('#scroller { position: absolute; inset: 0; min-height: 100%; height: auto; }');" +
"this.shadowRoot.adoptedStyleSheets = [...this.shadowRoot.adoptedStyleSheets, s];"
);
Expected-behavior
Grid should have an internal vertical scrollbar, same as with the Lumo theme
Reproduction
- Create a Vaadin 25 application with @Stylesheet(Aura.STYLESHEET) on the AppShellConfigurator
- Add a Grid with more items than fit in the viewport
- Place the Grid inside a horizontal SplitLayout (default orientation) within a VerticalLayout
- Observe: no vertical scrollbar, the page scrolls instead of the grid
System Info
- Vaadin 25.0.7
- Aura theme loaded via @Stylesheet(Aura.STYLESHEET)
- Grid inside SplitLayout inside VerticalLayout