Skip to content

Commit 5c8c79c

Browse files
perf: add CSS containment to injected margin panel (#367)
Adding `contain: layout style` to `.fmc-margin-panel` isolates the panel's layout and style recalculations from the rest of the Fidelity Angular host document. Fidelity's Angular SPA generates frequent DOM mutations throughout the trade ticket UI. Without containment, each mutation potentially triggers a full-page layout or style recalculation that includes the panel subtree, even when the panel itself hasn't changed. With `contain: layout style`, the browser knows that: - Changes inside the panel don't affect layout outside it (layout) - CSS counters/quotes inside the panel don't escape to the document (style) `paint` is intentionally excluded from the contain value so that focus rings and scrollbar chrome are not clipped to the panel's box bounds, which matters for the focusable debug log element. `contain` has been supported since Chrome 52, well within the extension's `minimum_chrome_version: 111` requirement. Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 52bff75 commit 5c8c79c

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

content/styles.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@
3636
font-size: 12px;
3737
color: var(--fmc-text);
3838
position: relative;
39+
/* CSS containment: isolate the panel's layout and style from the rest of the
40+
Fidelity page so that DOM mutations within the panel (value updates, state
41+
transitions) do not trigger layout/style recalculations in the Angular host
42+
document. `paint` is intentionally omitted to preserve visible focus rings
43+
and scrollbar chrome that may extend past the box bounds in some browsers. */
44+
contain: layout style;
3945
}
4046

4147
/* Subtle background tint based on status */

0 commit comments

Comments
 (0)