Skip to content

fix: Prevent TypeError in downshift on iOS Safari#3999

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gazebo-17zr-downshift-null-body
Open

fix: Prevent TypeError in downshift on iOS Safari#3999
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/gazebo-17zr-downshift-null-body

Conversation

@sentry

@sentry sentry Bot commented Jun 10, 2026

Copy link
Copy Markdown

Description

This PR addresses GAZEBO-17ZR, a TypeError: null is not an object (evaluating 'e.body.appendChild') occurring in the downshift library.

The root cause was identified as downshift's debounced accessibility status update (updateA11yStatus) attempting to access document.body.appendChild after a component has unmounted, specifically on iOS Safari during SPA navigation where document.body can be temporarily null.

Code Example

Notable Changes

To fix the TypeError, a new hook useDownshiftEnvironment was created. This hook provides a custom environment object to downshift's useCombobox hook. This custom environment proxies window.document.body to return a null-safe object with no-op appendChild and removeChild methods when document.body is null. This prevents the TypeError without affecting accessibility functionality under normal conditions.

The useDownshiftEnvironment hook has been integrated into both src/ui/MultiSelect/MultiSelect.jsx and src/ui/Select/Select.jsx components, which utilize downshift.

Screenshots

Link to Sample Entry

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

Fixes GAZEBO-17ZR

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Bundle Report

Changes will increase total bundle size by 807 bytes (0.01%) ⬆️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
gazebo-production-system 5.87MB 389 bytes (0.01%) ⬆️
gazebo-production-esm 5.96MB 418 bytes (0.01%) ⬆️

Affected Assets, Files, and Routes:

view changes for bundle: gazebo-production-system

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index-legacy.*.js 1 bytes 29.52kB 0.0%
assets/index-legacy.*.js 1 bytes 4.41kB 0.02%
assets/index-legacy.*.js 1 bytes 29.91kB 0.0%
assets/index-legacy.*.js 1 bytes 45.41kB 0.0%
assets/index-legacy.*.js 1 bytes 5.63kB 0.02%
assets/index-legacy.*.js 1 bytes 84.77kB 0.0%
assets/index-legacy.*.js 1 bytes 9.61kB 0.01%
assets/index-legacy.*.js 1 bytes 35.22kB 0.0%
assets/index-legacy.*.js 1 bytes 31.64kB 0.0%
assets/index-legacy.*.js 1 bytes 13.1kB 0.01%
assets/index-legacy.*.js 1 bytes 12.28kB 0.01%
assets/index-legacy.*.js 1 bytes 7.4kB 0.01%
assets/index-legacy.*.js 342 bytes 717.2kB 0.05%
assets/index-legacy.*.js 1 bytes 20.91kB 0.0%
assets/index-legacy.*.js 1 bytes 26.31kB 0.0%
assets/index-legacy.*.js 1 bytes 7.81kB 0.01%
assets/index-legacy.*.js 1 bytes 9.46kB 0.01%
assets/index-legacy.*.js 1 bytes 11.63kB 0.01%
assets/BillingDetails-legacy.*.js 1 bytes 27.44kB 0.0%
assets/ConfigureCachedBundleModal-legacy.*.js 1 bytes 7.87kB 0.01%
assets/MultiSelect-legacy.*.js 28 bytes 4.89kB 0.58%

Files in assets/index-legacy.*.js:

  • ./src/ui/shared/useDownshiftEnvironment.js → Total Size: 995 bytes

  • ./src/ui/Select/Select.jsx → Total Size: 7.86kB

Files in assets/MultiSelect-legacy.*.js:

  • ./src/ui/MultiSelect/MultiSelect.jsx → Total Size: 9.57kB
view changes for bundle: gazebo-production-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
assets/index.*.js 1 bytes 90.03kB 0.0%
assets/index.*.js 1 bytes 7.75kB 0.01%
assets/index.*.js 1 bytes 31.28kB 0.0%
assets/index.*.js 1 bytes 49.15kB 0.0%
assets/index.*.js 1 bytes 26.27kB 0.0%
assets/index.*.js 1 bytes 12.42kB 0.01%
assets/index.*.js 1 bytes 12.28kB 0.01%
assets/index.*.js 1 bytes 32.48kB 0.0%
assets/index.*.js 1 bytes 32.26kB 0.0%
assets/index.*.js 358 bytes 639.76kB 0.06%
assets/index.*.js 1 bytes 22.2kB 0.0%
assets/index.*.js 1 bytes 4.6kB 0.02%
assets/index.*.js 1 bytes 5.86kB 0.02%
assets/index.*.js 1 bytes 9.58kB 0.01%
assets/index.*.js 6 bytes 14.56kB 0.04%
assets/index.*.js 6 bytes 10.05kB 0.06%
assets/index.*.js 1 bytes 7.45kB 0.01%
assets/index.*.js 1 bytes 36.76kB 0.0%
assets/BillingDetails.*.js 6 bytes 29.72kB 0.02%
assets/CIStatus.*.js -5 bytes 18.5kB -0.03%
assets/ConfigureCachedBundleModal.*.js 1 bytes 8.31kB 0.01%
assets/MultiSelect.*.js 31 bytes 5.01kB 0.62%

Files in assets/index.*.js:

  • ./src/ui/Select/Select.jsx → Total Size: 7.84kB

  • ./src/ui/shared/useDownshiftEnvironment.js → Total Size: 995 bytes

Files in assets/MultiSelect.*.js:

  • ./src/ui/MultiSelect/MultiSelect.jsx → Total Size: 9.56kB

@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.72%. Comparing base (ca9dc5d) to head (1ed6cc8).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/shared/useDownshiftEnvironment.js 84.61% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3999      +/-   ##
==========================================
- Coverage   98.73%   98.72%   -0.02%     
==========================================
  Files         827      828       +1     
  Lines       15133    15148      +15     
  Branches     4357     4361       +4     
==========================================
+ Hits        14942    14955      +13     
- Misses        184      186       +2     
  Partials        7        7              
Files with missing lines Coverage Δ
src/ui/MultiSelect/MultiSelect.jsx 100.00% <100.00%> (ø)
src/ui/Select/Select.jsx 100.00% <100.00%> (ø)
src/ui/shared/useDownshiftEnvironment.js 84.61% <84.61%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 98.88% <86.66%> (-0.13%) ⬇️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca9dc5d...1ed6cc8. Read the comment docs.

@codecov-public-qa

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 98.72%. Comparing base (ca9dc5d) to head (1ed6cc8).

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/shared/useDownshiftEnvironment.js 84.61% 2 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3999      +/-   ##
==========================================
- Coverage   98.73%   98.72%   -0.02%     
==========================================
  Files         827      828       +1     
  Lines       15133    15148      +15     
  Branches     4357     4369      +12     
==========================================
+ Hits        14942    14955      +13     
- Misses        184      186       +2     
  Partials        7        7              
Files with missing lines Coverage Δ
src/ui/MultiSelect/MultiSelect.jsx 100.00% <100.00%> (ø)
src/ui/Select/Select.jsx 100.00% <100.00%> (ø)
src/ui/shared/useDownshiftEnvironment.js 84.61% <84.61%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 98.88% <86.66%> (-0.13%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca9dc5d...1ed6cc8. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codecov-notifications

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/ui/shared/useDownshiftEnvironment.js 84.61% 2 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3999      +/-   ##
==========================================
- Coverage   98.73%   98.72%   -0.02%     
==========================================
  Files         827      828       +1     
  Lines       15133    15148      +15     
  Branches     4365     4369       +4     
==========================================
+ Hits        14942    14955      +13     
- Misses        184      186       +2     
  Partials        7        7              
Files with missing lines Coverage Δ
src/ui/MultiSelect/MultiSelect.jsx 100.00% <100.00%> (ø)
src/ui/Select/Select.jsx 100.00% <100.00%> (ø)
src/ui/shared/useDownshiftEnvironment.js 84.61% <84.61%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 98.88% <86.66%> (-0.13%) ⬇️

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca9dc5d...1ed6cc8. Read the comment docs.

@codecov-releaser

Copy link
Copy Markdown
Collaborator

✅ Deploy preview for gazebo ready!

Previews expire after 1 month automatically.

Storybook

Commit Created Cloud Enterprise
1ed6cc8 Wed, 10 Jun 2026 03:58:07 GMT Cloud Enterprise

@codecov-qa

codecov-qa Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 86.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 98.72%. Comparing base (ca9dc5d) to head (1ed6cc8).

Files with missing lines Patch % Lines
src/ui/shared/useDownshiftEnvironment.js 84.61% 2 Missing ⚠️
@@            Coverage Diff             @@
##             main    #3999      +/-   ##
==========================================
- Coverage   98.73%   98.72%   -0.02%     
==========================================
  Files         827      828       +1     
  Lines       15133    15148      +15     
  Branches     4357     4369      +12     
==========================================
+ Hits        14942    14955      +13     
- Misses        184      186       +2     
  Partials        7        7              
Files with missing lines Coverage Δ
src/ui/MultiSelect/MultiSelect.jsx 100.00% <100.00%> (ø)
src/ui/Select/Select.jsx 100.00% <100.00%> (ø)
src/ui/shared/useDownshiftEnvironment.js 84.61% <84.61%> (ø)
Components Coverage Δ
Assets 100.00% <ø> (ø)
Layouts 99.71% <ø> (ø)
Pages 98.37% <ø> (ø)
Services 99.32% <ø> (ø)
Shared 98.95% <ø> (ø)
UI 98.88% <86.66%> (-0.13%) ⬇️

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ca9dc5d...1ed6cc8. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant