Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mvc] CSS isolation fails with some HTML constructs #32542

Closed
javiercn opened this issue May 10, 2021 · 5 comments
Closed

[Mvc] CSS isolation fails with some HTML constructs #32542

javiercn opened this issue May 10, 2021 · 5 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-razor.compiler This issue is related to the Razor compiler (now external) bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed feature-css-isolation This issue is related to CSS Isolation feature
Milestone

Comments

@javiercn
Copy link
Member

For the provided markup:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewData["Title"] - tmp</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="~/css/site.css" />

    <link rel="stylesheet" href="tmp.styles.css" />
</head>

We produce:

<!DOCTYPE html>
 b-0pr8yvohll<html b-0pr8yvohll lang="en">
<head>
    <meta b-0pr8yvohll charset="utf-8" />
    <meta b-0pr8yvohll name="viewport" content="width=device-width, initial-scale=1.0" />
    <title b-0pr8yvohll>Home Page - tmp</title>
    <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css" />
    <link rel="stylesheet" href="/css/site.css" />

    <link b-0pr8yvohll rel="stylesheet" href="tmp.styles.css" />
</head>
  • We should fix adding the scope after the doctype declaration
  • We should stay away from applying the scope to meta, title, and other tags that appear only within the HEAD
@javiercn javiercn added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-razor.compiler This issue is related to the Razor compiler (now external) feature-css-isolation This issue is related to CSS Isolation feature labels May 10, 2021
@javiercn
Copy link
Member Author

Motivating issue here

@mkArtakMSFT mkArtakMSFT added the bug This issue describes a behavior which is not expected - a bug. label May 10, 2021
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone May 10, 2021
@ghost
Copy link

ghost commented May 10, 2021

Thanks for contacting us.

We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@mkArtakMSFT
Copy link
Member

@captainsafia do you think this is something you've already addressed?

@captainsafia
Copy link
Member

We should fix adding the scope after the doctype declaration

This part was fixed in #31257. I haven't been able to repro the original issue on preview5 (ref)

We should stay away from applying the scope to meta, title, and other tags that appear only within the HEAD

Yep, this makes sense. I believe this happens at a different pass in the compiler so we'll have to track that down and adjust it.

@mkArtakMSFT It should be doable for preview5.

@captainsafia
Copy link
Member

Yep, this makes sense. I believe this happens at a different pass in the compiler so we'll have to track that down and adjust it.

Moving this to preview5 milestone since I put out a PR with a fix.

@ghost ghost added the Working label May 17, 2021
@ghost ghost added Done This issue has been fixed and removed Working labels May 17, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates area-razor.compiler This issue is related to the Razor compiler (now external) bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed feature-css-isolation This issue is related to CSS Isolation feature
Projects
None yet
Development

No branches or pull requests

3 participants