Repository navigation
[utils] Fix pseudo-element bounds in dev - #5000
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,096.15 ms -204.06 ms(-15.7%) | Renders: 50 (+0) | Paint: 1,656.81 ms -303.19 ms(-15.5%)
8 tests within noise — details Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
b5b9a55 to
ff64de3
Compare
ff64de3 to
77ce714
Compare
Code Review (GPT-5.5)Approve ✅ The patch fixes the dev-browser pseudo-element bounds path while preserving the jsdom escape hatch, with focused coverage in both jsdom and Chromium. 1. Bugs / Issues (None)I didn’t find any blocking or non-blocking issues in the full branch diff against freshly fetched 2. Root Cause & Patch AssessmentThe previous 3. Test Coverage AssessmentThe new tests cover both sides of the behavior: jsdom returns the element rect without calling Validation run: All passed, and GitHub checks for the PR head are green. |
There was a problem hiding this comment.
Pull request overview
This PR fixes getPseudoElementBounds so pseudo-element hit-area expansion is no longer skipped in development browsers, while still avoiding jsdom’s unsupported getComputedStyle(..., pseudoElt) behavior. It also adds targeted tests for the jsdom-safe path and for pseudo-element bounds expansion when running in a real browser environment.
Changes:
- Switch the jsdom workaround from a broad non-production guard to a jsdom-specific environment check.
- Add a new test suite covering the jsdom path and the browser pseudo-element bounds path.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/react/src/utils/getPseudoElementBounds.ts | Updates environment gating so development browsers compute pseudo-element bounds while jsdom returns the element rect. |
| packages/react/src/utils/getPseudoElementBounds.test.ts | Adds tests for the jsdom-safe path and for pseudo-element bounds expansion in browser mode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
A change labeled with a component or all components is for users, even with a prefix such as [utils]: mui#5000 was published in v1.6.0.
Pseudo-element hit-area expansion was skipped in every non-production build. This keeps jsdom on the safe path while allowing real development browsers to calculate pseudo-element bounds.
Root cause
The jsdom workaround was tied to
NODE_ENV, so development browsers returned the element rect before reading pseudo-element styles.Changes