Skip to content

fix: modernize HTML sample snippet#304818

Merged
Yoyokrazy merged 2 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/html-sample-snippet-modernize
Mar 27, 2026
Merged

fix: modernize HTML sample snippet#304818
Yoyokrazy merged 2 commits intomicrosoft:mainfrom
yogeshwaran-c:fix/html-sample-snippet-modernize

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Enhancement / Polish

What is the current behavior?

The built-in HTML sample snippet (triggered by typing html in an empty HTML file) contains outdated elements:

  • Missing lang attribute on <html> tag (W3C recommends always specifying)
  • Includes <meta http-equiv='X-UA-Compatible' content='IE=edge'> (IE is no longer supported)
  • <link> tag has unnecessary type='text/css' and media='screen' attributes (these are default values in HTML5)
  • Includes a <script> tag in <head> (modern practices often defer scripts or handle them differently)

Closes #272331

What is the new behavior?

The snippet now produces a cleaner, modern HTML5 template:

<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='utf-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <title>Page Title</title>
    <link rel='stylesheet' href='main.css'>
</head>
<body>
    
</body>
</html>

Tab stops:

  1. lang attribute value (en default)
  2. Page title
  3. Stylesheet href
  4. Body content (final cursor position)

Additional context

The maintainer (@aeschli) explicitly welcomed a PR for this change: "A pull request is welcome, please change it as you think it is the most useful."

Changes are minimal and focused on removing outdated patterns while adding the commonly expected lang attribute.

Update the built-in HTML sample snippet to follow current web standards
and reduce unnecessary boilerplate:

- Add lang attribute to <html> tag as first tab stop (W3C recommended)
- Remove outdated IE compatibility meta tag (IE is no longer supported)
- Remove unnecessary type='text/css' and media='screen' from <link>
  (default values in HTML5)
- Remove <script> tag (modern templates often handle scripts differently)
- Move viewport meta before title (following common convention)

Fixes microsoft#272331
@vs-code-engineering vs-code-engineering bot added this to the 1.114.0 milestone Mar 25, 2026
@Yoyokrazy Yoyokrazy merged commit 7466d76 into microsoft:main Mar 27, 2026
18 checks passed
@RoeiMeiri9
Copy link
Copy Markdown

Oh, this is a brilliant solution! Thank you :)

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.

[html] improve HTML sample snippet: Don’t prompt for viewport values

5 participants