Skip to content

Fix index.ts section causing "Illegal constructor" on older iOS devices#4531

Merged
dvoituron merged 1 commit intomicrosoft:devfrom
GusPietrasanta-Polygon:fix/illegal-constructor-older-ios
Feb 18, 2026
Merged

Fix index.ts section causing "Illegal constructor" on older iOS devices#4531
dvoituron merged 1 commit intomicrosoft:devfrom
GusPietrasanta-Polygon:fix/illegal-constructor-older-ios

Conversation

@GusPietrasanta-Polygon
Copy link
Copy Markdown
Contributor

Pull Request

📖 Description

Similarly to #1520, added handling for browsers that don't support CSSStyleSheet() constructor to index.ts. Adds feature detection around document.adoptedStyleSheets and falls back to injecting a <style> element when constructable stylesheets are unavailable. This follows the same approach used in #1520 (related to #1481).

🎫 Issues

Related to #1481

👩‍💻 Reviewer Notes

Change is limited to index.ts and only affects stylesheet injection logic. It caused the website to not render at all on any device running iOS 16.3 or older (can be tested on the same project demo website), logging a Illegal constructor error.

Recommend verifying:

  • Styles still apply correctly in modern browsers
  • No runtime errors occur on older iOS/Safari versions

📑 Test Plan

  • Tested in a modern browser (constructable stylesheet path)
  • Verified fallback logic on iPad running iPadOS 16.3.1
  • Confirmed demo site renders, styles are applied correctly, and no errors occur in both paths
  • All provided unit tests pass successfully

✅ Checklist

General

  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

⏭ Next Steps

@vnbaaij vnbaaij added this to the v4.14.1 milestone Feb 18, 2026
@dvoituron dvoituron merged commit 50374d8 into microsoft:dev Feb 18, 2026
2 checks passed
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.

3 participants