@primer/react@38.7.0
Minor Changes
- #7293
d418509Thanks @lindseywild! - Adds character counts to TextInput and TextArea components
Patch Changes
-
#7354
efbebdfThanks @llastflowers! - update SelectPanel Multi Select Modal story -
#7426
094be60Thanks @kelsey-myers! - Add focusPrependedElements prop to useFocusZone, FilteredActionList, and SelectPanel -
#7349
713d5a5Thanks @mattcosta7! - PageLayout: Optimize drag/resize performance with inline styles and new optimizationsRefactored:
- Use direct attribute selectors (
.Pane[data-dragging='true']) instead of descendant selectors for CSS containment (O(1) vs O(n) selector matching) - Extract optimization utilities to
paneUtils.ts - Apply drag handle visual feedback via inline styles and CSS variables
Added:
content-visibility: autoduring drag/resize to skip off-screen content rendering- rAF throttle for drag updates (one update per frame, latest position wins)
- Containment during window resize (parity with drag)
These changes improve style recalculation performance on large DOMs (100k+ nodes) by eliminating descendant selector traversal.
- Use direct attribute selectors (
-
#7337
de970d6Thanks @mattcosta7! - perf(Autocomplete): Split context to reduce unnecessary re-rendersSplit AutocompleteContext into separate contexts for static values, setters, and dynamic state.
Components now subscribe only to the context slices they need, reducing re-renders. -
#7325
cc7e10eThanks @mattcosta7! - perf(BaseStyles): Remove expensive :has([data-color-mode]) selectorsRemove
:has([data-color-mode])selectors that scanned the entire DOM on every style recalculation.
Input color-scheme is already handled by global selectors in the codebase. -
#7329
501a41fThanks @mattcosta7! - perf(Dialog): Add feature flag for CSS :has() selector performance optimization- Add
primer_react_css_has_selector_perffeature flag (default: false) - When flag is OFF: uses legacy
body:has(.Dialog.DisableScroll)selector - When flag is ON: uses optimized direct
body[data-dialog-scroll-disabled]data attribute with ref counting - Enables gradual rollout and easy rollback of performance optimization
- Add
-
#7342
a8b42b2Thanks @mattcosta7! - perf(hasInteractiveNodes): Optimize with combined selector and early attribute checks- Use combined querySelectorAll selector instead of recursive traversal
- Check attribute-based states (disabled, hidden, inert) before getComputedStyle
- Only call getComputedStyle when CSS-based visibility check is needed