Skip to content

bug: Error with adoptedStyleSheets in Angular 18 and Ionic project #29593

@papastepano

Description

@papastepano

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

I'm encountering an error related to adoptedStyleSheets in my Angular 18 and Ionic project. The console shows the following error:
TypeError: Failed to set the 'adoptedStyleSheets' property on 'Document': Failed to convert value to 'CSSStyleSheet'.

Expected Behavior

The application should run without any errors related to adoptedStyleSheets.

Steps to Reproduce

  1. Clone the repository: git clone https://github.com/papastepano/try-ionic
  2. Install dependencies: npm install
  3. Run the development server: ng serve
  4. Open the application in a browser and check the console for the error.

Code Reproduction URL

https://github.com/papastepano/try-ionic

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (C:\Users\DELL\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 8.2.1
@angular-devkit/build-angular : 18.0.3
@angular-devkit/schematics : 18.0.3
@angular/cli : 18.0.3
@ionic/angular-toolkit : 11.0.1

Utility:

cordova-res : not installed globally
native-run : not installed globally

System:

NodeJS : v20.11.0 (C:\Program Files\nodejs\node.exe)
npm : 10.4.0
OS : Windows 10

Additional Information

I suspect this might be due to browser compatibility or an issue with how CSSStyleSheet is being used in the project. Any insights or fixes would be appreciated.
Feel free to create a PR to the repo if you have a suggestion

Metadata

Metadata

Assignees

No one assigned

    Labels

    stencilIssues that require changes in Stencil

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions