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

smartlink to fallback on en-US #3133

Merged

Conversation

peterbe
Copy link
Contributor

@peterbe peterbe commented Mar 4, 2021

@peterbe
Copy link
Contributor Author

peterbe commented Mar 4, 2021

@chrisdavidmills I basically just took your suggestion.

@schalkneethling Please review my use of the <small> tag for the (en-US) portion.

@fiji-flo Would it be better to go through the translationsOf Map object?

Copy link
Contributor

@fiji-flo fiji-flo left a comment

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@escattone escattone left a comment

Choose a reason for hiding this comment

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

On my phone, so unable to test. Just a tiny nit for now.

kumascript/src/api/web.js Show resolved Hide resolved
@peterbe peterbe requested a review from escattone March 4, 2021 18:56
Copy link
Contributor

@escattone escattone left a comment

Choose a reason for hiding this comment

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

Love it, looks and works great, thanks @peterbe!

@escattone
Copy link
Contributor

@schalkneethling I know you have a lot on your plate, but would you mind giving this a quick review for any a11y concerns, specifically regarding the use of <small> tag?

Copy link
Contributor

@schalkneethling schalkneethling left a comment

Choose a reason for hiding this comment

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

This is going to be so awesome. Thank you, Peter. Just one change recommendation.

Comment on lines 100 to 105
return (
'<a class="page-only-in-english" ' +
'title="Page currently only available in English" ' +
`href="${enUSPage.url}"${flawAttribute}>${content} <small>(en-US)</small></a>`
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return (
'<a class="page-only-in-english" ' +
'title="Page currently only available in English" ' +
`href="${enUSPage.url}"${flawAttribute}>${content} <small>(en-US)</small></a>`
);
}
return (
'<a class="page-only-in-english" ' +
'title="Page currently only available in English" ' +
`href="${enUSPage.url}"${flawAttribute}>${content} <span>(en-US)</span></a>`
);

Then in client/src/document/index.scss add the following:

.page-only-in-english {
  span {
    font-size: $small-font-size;
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Will do.
But why add more CSS that can be expressed semantically with HTML? I'm not questioning, I'm trying to learn.

Copy link
Contributor

Choose a reason for hiding this comment

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

I know, sometimes I want to change my mind about the use of these elements but, we would need CSS anyhow to ensure that the small element uses the $small-font-size. I am kinda undecided on that one.

@peterbe
Copy link
Contributor Author

peterbe commented Mar 9, 2021

I changed the tooltip slightly too. Not saying the word "Page". Or "Document". Just...
Screen Shot 2021-03-09 at 7 44 39 AM

@peterbe peterbe force-pushed the 3053-smartlink-to-fallback-on-en-us branch from e5e04f5 to 968d9cd Compare March 9, 2021 13:24
Copy link
Contributor

@schalkneethling schalkneethling left a comment

Choose a reason for hiding this comment

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

🎉 - Thank you @peterbe

@schalkneethling schalkneethling merged commit cc94971 into mdn:main Mar 9, 2021
@peterbe peterbe deleted the 3053-smartlink-to-fallback-on-en-us branch March 9, 2021 15:26
peterbe added a commit to peterbe/yari that referenced this pull request Jun 1, 2021
* smartLink to fallback on en-US

Fixes mdn#3053

* finish

* feedbacked
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.

smartLink() should fall back to English in some way
4 participants