Skip to content

CSS Selector with umlaut broken in production mode with emulated view encapsulation  #48524

Closed

Description

@rothsandro

Which @angular/* package(s) are the source of the bug?

compiler

Is this a regression?

No

Description

Encapsulated styles using CSS class selectors with umlauts don't work properly in production mode. The compiler inserts the ngcontent placeholder after the umlaut and breaks the selector.

It works in development mode.
It works when using no encapsulation or Shadow DOM.

The bug does not occur for all words, some examples:

  • ❌ .über {} => .\fc[_ngcontent-fji-c1] ber[_ngcontent-fji-c1] {}
  • ❌ .prüfung {} => .pr\fc[_ngcontent-fji-c1] fung[_ngcontent-fji-c1] {}
  • ✅ .zufällig {} => .zuf\e4llig[_ngcontent-fji-c1] {}

css-umlauts

Please provide a link to a minimal reproduction of the bug

Repo: https://github.com/rothsandro/repro.ng-css-umlauts
Deployed: https://leafy-starburst-2edda1.netlify.app/

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.0.4
Node: 16.13.0
Package Manager: npm 8.1.0
OS: darwin arm64

Angular: 15.0.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.4
@angular-devkit/build-angular   15.0.4
@angular-devkit/core            15.0.4
@angular-devkit/schematics      15.0.4
@schematics/angular             15.0.4
rxjs                            7.5.7
typescript                      4.8.4

Anything else?

No response

Activity

  1. JeanMeche commented on Dec 17, 2022

    @JeanMeche
    Member

    I was able to reproduce it with both optimization.minify: true & aot: true.
    https://stackblitz.com/edit/angular-pbc8vn

    Why both :

    • optimization.minify triggers the EsBuild optimizer which escapes the selector : .über {} becomes .\fc ber { } (demo on stackblitz). This selector with a space after the escaped character is valid. The space is inserted every time the special character is followed by a hex characters (0-9a-f)
    • AOT messes everything up because it interpret's this as 2 different selectors.
  2. added
    area: compiler
    on Jan 4, 2023
  3. added this to the needsTriage milestone on Jan 4, 2023
  4. added a commit that references this issue on Jan 24, 2023
    1ba1105
  5. added a commit that references this issue on Jan 24, 2023
    98ccb57
  6. added a commit that references this issue on Feb 1, 2023
    90b4574
  7. angular-automatic-lock-bot commented on Feb 24, 2023

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  8. locked and limited conversation to collaborators on Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: compilerarea: corebugcore: stylesheetsstate: has PR

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions