Skip to content

Commit 978e867

Browse files
keithamusansballardAdamShwertareliaarielvalentin
authoredOct 11, 2024
reduce cost of style calc+layout in --dialog-scrollgutter (#3144)
Co-authored-by: Aaron Ballard <ansballard@github.com> Co-authored-by: AdamShwert <adamshwert@github.com> Co-authored-by: Arelia Jones <2359538+arelia@users.noreply.github.com> Co-authored-by: Ariel Valentin <arielvalentin@users.noreply.github.com> Co-authored-by: Chris Gavin <chris@chrisgavin.me> Co-authored-by: Cody Bodfield <cbodfield@github.com> Co-authored-by: Daniel Colson <composerinteralia@github.com> Co-authored-by: Daniel Garman <garman@github.com> Co-authored-by: Dusty Greif <dgreif@users.noreply.github.com> Co-authored-by: Erinna Chen <erinnachen@users.noreply.github.com> Co-authored-by: George Brocklehurst <george@georgebrock.com> Co-authored-by: Jibran Garcia <jibrang@github.com> Co-authored-by: Jonathan Fuchs <21195+jfuchs@users.noreply.github.com> Co-authored-by: Kate Higa <16447748+khiga8@users.noreply.github.com> Co-authored-by: Manuel Puyol <manuelpuyol@github.com> Co-authored-by: Matthew Costabile <mattcosta7@github.com> Co-authored-by: Matthew Reyes <another-mattr@github.com> Co-authored-by: Melissa Pastore <64283754+MelissaPastore@users.noreply.github.com> Co-authored-by: Ned Schwartz <theinterned@github.com> Co-authored-by: Phill MV <phillmv@github.com> Co-authored-by: Raffaele Di Fazio <raffo@github.com> Co-authored-by: Sarah Vessels <82317+cheshire137@users.noreply.github.com> Co-authored-by: Simon Taranto <srt32@users.noreply.github.com>
1 parent 7e7a60f commit 978e867

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
 

‎.changeset/wicked-bananas-tie.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/view-components': patch
3+
---
4+
5+
Remove dialog-scrollgutter setting from hot-path, for improved performance

‎app/components/primer/alpha/dialog.pcss

+15
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,22 @@
88

99
/* Overlay */
1010

11+
/* The --dialog-scrollgutter property is used only on the body element to
12+
* simulate scrollbar-gutter:stable. This property is not and should not
13+
* be used elsewhere in the DOM. There is a performance penalty to
14+
* setting inherited properties which can cause a large style recalc to
15+
* occur, so it benefits us to prevent inheritance for this property.
16+
* See https://web.dev/blog/at-property-performance
17+
*/
18+
@property --dialog-scrollgutter {
19+
initial-value: 0;
20+
inherits: false;
21+
syntax: "<length>";
22+
}
23+
1124
/* TODO: One day this can be :has(:modal), when it is better supported */
1225
body.has-modal {
26+
/* stylelint-disable-next-line csstools/value-no-unknown-custom-properties */
1327
padding-right: var(--dialog-scrollgutter) !important;
1428
overflow: hidden !important;
1529
}
@@ -350,6 +364,7 @@ dialog.Overlay:not([open]) {
350364
&:hover,
351365
&:focus {
352366
background-color: var(--button-default-bgColor-hover);
367+
/* stylelint-disable-next-line primer/colors */
353368
border: var(--borderWidth-thin) solid var(--control-bgColor-hover);
354369
}
355370

0 commit comments

Comments
 (0)