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

New IE flexbox compat hint #4073

Merged
merged 7 commits into from
Nov 5, 2020

Conversation

captainbrosset
Copy link
Contributor

This is an attempt to address #4072.

A hint that warns users when they do configure IE as a target browser and flexbox is used in one of the stylesheets.
This is mostly to get the ball rolling and gather feedback.

Let me know what you think.

Hint that warns users when they do configure IE as a target browser and
flexbox is used in one of the stylesheets.

This is the initial commit, with the boilerplate code only.
More work is needed on the message, and on adding tests.
This is just to get the ball rolling.

Fix: webhintio#4072
We may also want to embed URLs for users to find out more, but this is a
good first step.
*/

export default class IEFlexboxCompatHint implements IHint {
public static readonly meta: HintMetadata = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meta needs to be in its own file (meta.ts) and imported. (e.g. https://github.com/webhintio/hint/blob/main/packages/hint-manifest-is-valid/src/hint.ts).
We use the meta file to generate the documentation in the website.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Done.

},
"usingFlexWithIE": {
"description": "String warning users that flex is used and IE is a target browser",
"message": "The Internet Explorer brower versions 11 and older suffer from a number of CSS Flexbox compatibility bugs. The layout on this page may be different between Internet Explorer and other, more recent, browsers. The size or alignment of elements may be incorrect and content may overflow.\nSupport for older versions of Internet Explorer ended and Microsoft no longer provides security updates or technical support for these versions."
Copy link
Member

@antross antross Oct 16, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep the message a bit more concise and leave the details for the README.

Suggested change
"message": "The Internet Explorer brower versions 11 and older suffer from a number of CSS Flexbox compatibility bugs. The layout on this page may be different between Internet Explorer and other, more recent, browsers. The size or alignment of elements may be incorrect and content may overflow.\nSupport for older versions of Internet Explorer ended and Microsoft no longer provides security updates or technical support for these versions."
"message": "CSS Flexbox may render differently in Internet Explorer than more recent browsers. Check this page in IE then see the documentation for workarounds if needed."

Copy link
Member

@antross antross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start. We'll want a good README.md added as well (which will be published as the doc page on webhint.io). I'd expect to call out an example issue there then link to the full list of bugs + workarounds.


let reported = false;

context.on('parse::end::css', ({ ast, element, resource }: StyleParse) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I don't think you need to specify the type here as it should be inferred from the event name.

Suggested change
context.on('parse::end::css', ({ ast, element, resource }: StyleParse) => {
context.on('parse::end::css', ({ ast, element, resource }) => {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I will address this.

return;
}

let reported = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the VS Code extension or CLI in watch mode this will never get reset between runs (causing the error message to disappear). Add a 'scan::end' listener to the context to reset this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Will do.

@captainbrosset
Copy link
Contributor Author

Oh you're right, I forgot to add a README file. I'll simplify the message and instead write a longer README.

@antross
Copy link
Member

antross commented Oct 30, 2020

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@antross
Copy link
Member

antross commented Nov 2, 2020

@captainbrosset FYI just looks like this is hitting a linting failure on the updated README:


README.md: 3: MD013/line-length Line length [Expected: 80; Actual: 96]
README.md: 7: MD013/line-length Line length [Expected: 80; Actual: 87]
README.md: 8: MD013/line-length Line length [Expected: 80; Actual: 107]
README.md: 11: MD013/line-length Line length [Expected: 80; Actual: 109]
README.md: 15: MD013/line-length Line length [Expected: 80; Actual: 104]
README.md: 16: MD013/line-length Line length [Expected: 80; Actual: 105]
README.md: 20: MD013/line-length Line length [Expected: 80; Actual: 91]

Copy link
Member

@antross antross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @captainbrosset!

Copy link
Contributor

@sarvaje sarvaje left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@captainbrosset captainbrosset merged commit a5a9753 into webhintio:main Nov 5, 2020
@captainbrosset captainbrosset deleted the ie-flexbox-compat branch November 5, 2020 07:55
@captainbrosset
Copy link
Contributor Author

As a follow-up, should we add this hint to the default configuration? And if so, am I right in assuming this is the place to do so: packages\configuration-web-recommended\index.json ?

@antross
Copy link
Member

antross commented Nov 5, 2020

@captainbrosset that's one place, but there are also a few others to hit our default configurations in other contexts (browser extension, VS Code, etc.). There's probably a good TODO in here for establishing a common base config the others can extend from 😉

See this PR for a recent example: #4079

The online scanner also needs separately updated after a release. For now you can just log an issue like this one and @sarvaje will take care of it: webhintio/serverless-online-service#199

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