-
Notifications
You must be signed in to change notification settings - Fork 711
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
New IE flexbox compat hint #4073
Conversation
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 = { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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." |
There was a problem hiding this comment.
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.
"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." |
There was a problem hiding this 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) => { |
There was a problem hiding this comment.
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.
context.on('parse::end::css', ({ ast, element, resource }: StyleParse) => { | |
context.on('parse::end::css', ({ ast, element, resource }) => { |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Will do.
Oh you're right, I forgot to add a README file. I'll simplify the message and instead write a longer README. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@captainbrosset FYI just looks like this is hitting a linting failure on the updated README:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @captainbrosset!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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: |
@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 |
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.