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

i18n: tap targets #7111

Merged
merged 6 commits into from
Feb 4, 2019
Merged

Conversation

mattzeunert
Copy link
Contributor

i18n for tap targets audit.

Global one tries to match any content following `module.exports.UIStrings = UIStrings;` and then backtracks, so if there's more content the process will hang.
@@ -13,7 +13,7 @@ const path = require('path');
const esprima = require('esprima');

const LH_ROOT = path.join(__dirname, '../../../');
const UISTRINGS_REGEX = /UIStrings = (.|\s)*?\};\n/gim;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If this regex is global it tries to match any content following module.exports.UIStrings = UIStrings; and then backtracks. If there's some content after that line the collect-strings script hangs.

Copy link
Collaborator

Choose a reason for hiding this comment

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

btw this no longer collects all matches, but that's fine cuz we only ever use the first instance.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

nice thanks for following up with this!

// eslint-disable-next-line
explanationViewportMetaNotOptimized: 'Tap targets are too small because there\'s no viewport meta tag optimized for mobile screens',
/** Explanatory message stating that a certain percentage of the tap targets (like buttons and links) on the page are of an appropriately large size. */
displayValue: '{decimalProportion, number, percent} appropriately sized tap targets',
Copy link
Collaborator

Choose a reason for hiding this comment

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

is percent it's own thing already or do we need to make a custom one? I definitely see extendedPercent

Copy link
Member

Choose a reason for hiding this comment

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

percent is a default iirc, it just prunes decimals which is why we needed extendedPercent. As long as we are okay with no decimals then we should be good with percent here. Might need to add this to the LR tc bundler though, since I don't think we've ever used just percent so far.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Might need to add this to the LR tc bundler though, since I don't think we've ever used just percent so far.

What does this mean, and is it something I have to do?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anything left for me to do here? Or is this PR good to go?

Copy link
Collaborator

Choose a reason for hiding this comment

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

AFAICT, we never actually flex this in the tests, can we add an assertion for it looking like we expect? then I'm good :)

off to @exterkamp on the "LR tc" bit since I'm not 100% where that change would be made either

/** Label of a table column that identifies a tap target (like a link or button) that overlaps with another tap target. */
overlappingTargetHeader: 'Overlapping Target',
/** Explanatory message stating that there was a failure in an audit caused by the viewport meta tag not being optimized for mobile screens, which caused tap targets like buttons and links to be too small to tap on. */
// eslint-disable-next-line
Copy link
Collaborator

Choose a reason for hiding this comment

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

just line length? let's add max-len then to narrow it a bit

Copy link
Member

@exterkamp exterkamp left a comment

Choose a reason for hiding this comment

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

LGTM

// eslint-disable-next-line
explanationViewportMetaNotOptimized: 'Tap targets are too small because there\'s no viewport meta tag optimized for mobile screens',
/** Explanatory message stating that a certain percentage of the tap targets (like buttons and links) on the page are of an appropriately large size. */
displayValue: '{decimalProportion, number, percent} appropriately sized tap targets',
Copy link
Member

Choose a reason for hiding this comment

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

percent is a default iirc, it just prunes decimals which is why we needed extendedPercent. As long as we are okay with no decimals then we should be good with percent here. Might need to add this to the LR tc bundler though, since I don't think we've ever used just percent so far.

@exterkamp
Copy link
Member

Need to update the test to use toBeDisplayString for the textual checks.

Copy link
Collaborator

@patrickhulce patrickhulce left a comment

Choose a reason for hiding this comment

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

LGTM!!

Copy link
Member

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

LGTM3

@brendankenny brendankenny merged commit d875406 into GoogleChrome:master Feb 4, 2019
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.

5 participants