Defect #43742
closedMissing #wrapper positioning may increase reflow cost
Added by Jimmy Westberg 23 days ago. Updated 9 days ago.
Description
I have an issue type with a lot of long text input (full width). In the desktop mode the input latency was average 2000ms but in phone mode it was below 10ms. I looked at the wrapper element and this fixed my issue in desktop mode:
#wrapper {
position: relative;
}
Files
| 0001-Reduce-reflow-cost-by-adding-position-relative-to-wr.patch (744 Bytes) 0001-Reduce-reflow-cost-by-adding-position-relative-to-wr.patch | Go MAEDA, 2026-02-15 09:59 |
Updated by Jimmy Westberg 23 days ago
- Performance Issue Root Cause and Fix (Desktop vs Mobile Breakpoint)
We investigated a severe input latency problem on Redmine issue pages with many form fields.
In desktop layout (≥900px width), typing in input fields caused extreme delays (2–6 seconds per keystroke).
In responsive/mobile layout (<900px), the same page performed normally (~10–30ms latency).
- Key Finding
The performance difference was not caused by the menu itself or by the number of event handlers.
Instead, the root cause was a layout/positioning behavior related to the main page container:
- Desktop layout: `#wrapper` uses the default `position: static`
- Mobile layout: `#wrapper` becomes `position: relative`
Adding the following CSS rule immediately eliminated the input lag:
#wrapper {
position: relative;
}
- Why This Fix Works
Although `position: relative` does not visually move the wrapper, it changes browser layout behavior in an important way:
- It creates a stable containing block for absolutely positioned UI elements (dropdowns, autocompletes, datepickers, overlays).
- Without a positioned ancestor, such elements may be positioned relative to the document/body, which can trigger expensive global reflow/repaint operations.
- On large pages with many inputs, this can cause layout thrashing during typing (forced synchronous reflows on each key event).
Once `#wrapper` becomes a positioned ancestor, layout calculations become more localized and much cheaper, restoring normal responsiveness.
- Evidence
A breakpoint diff at 900px → 899px showed:
- `#wrapper` changes from `position: static` → `position: relative`
- Menus/sidebar are moved into an offscreen flyout structure
- Input latency drops from seconds to milliseconds
- Recommendation
Consider setting `#wrapper { position: relative; }` (or applying it specifically on issue pages) as a default, since it prevents catastrophic reflow behavior on large forms.
This appears to be a browser layout containment issue triggered by missing positioned ancestors in desktop mode.
Updated by Jimmy Westberg 22 days ago
21 to be exact but I got a feeling it's starting to be noticeable with 8-10
Updated by Go MAEDA 12 days ago
- File 0001-Reduce-reflow-cost-by-adding-position-relative-to-wr.patch 0001-Reduce-reflow-cost-by-adding-position-relative-to-wr.patch added
- Subject changed from Wrapper overflow edge case to Missing #wrapper positioning may increase reflow cost on large forms
- Category changed from UI - Responsive to Performance
- Target version set to Candidate for next major release
I could not reproduce the performance issue in my environment.
However, adding position: relative; to #wrapper does not cause layout problems, and it may help reduce potential reflow cost. Since mobile layout already uses this setting, I would like to apply the same change on desktop as a preventive improvement.
Updated by Jimmy Westberg 12 days ago
Yes that would probably be a good thing. My plugins (Additionals being a candidate) adds GUI elements which might be what's triggering this issue. Thank you for looking into this.