Skip to content

fix(docs-infra): yet more style fixes/improvements for angular.io - #41051

Closed
gkalpak wants to merge 15 commits into
angular:masterfrom
gkalpak:fix-aio-styles-6
Closed

gkalpak wants to merge 15 commits into
angular:masterfrom
gkalpak:fix-aio-styles-6

Conversation

@gkalpak

@gkalpak gkalpak commented Mar 2, 2021 •

Copy link
Copy Markdown
Member

Yet more style fixes/improvements for angular.io:

fix(docs-infra): do not underline link icons on hover (click to expand)

The external links in the docs content and the download links in the "Press kit" page have icons next to their text (an external link icon and a download icon respectively).

Previously, when hovering over one of those links, the icons used to get underlined along with the link text, which was not desirable.

This commit fixes it by changing the mechanics of how these icons are positioned inside the anchor elements so that only the link text is underlined on hover.

Before:

external links on hover before

Before:

presskit links on hover before

After:

external links on hover after

After:

presskit links on hover after


fix(docs-infra): use a fixed top-menu on marketing pages as well (click to expand)

Previously, in contrast to docs pages, marketing pages had a non-fixed top-menu, which meant that the top-menu would scroll out of the viewport along with the rest of the content. This had a couple of downsides:

  • The UI was different between pages (i.e. different top-menu behavior on docs vs marketing pages).
  • Since some of the marketing pages are long, it was not easy for people to navigate to a different page (i.e. they had to scroll all the way back up).

This commit improves the UX by using the same, fixed top-menu on all pages, which restores consistency and allows the user to navigate around more easily.

NOTE:
The old behavior (non-fixed top-menu) is kept on the homepage, since its top-menu design in a little different than other pages (e.g. it uses a transparent top-menu) and would not play well with a fixed top-menu.


fix(docs-infra): improve the layout of the "Features" page on medium screens (click to expand)

The "Features" page organizes features in groups/rows of 3 features each. On wide screens, all 3 paragraphs of a group/row can be shown next to each other. On narrow screens, the layout changes to stack the paragraphs vertically. On medium screens, however, the 3rd paragragh is wrapped over to the next line.

Previously, the wrapped content was left-aligned, which left a lot of empty space on the right.

This commit improves the layout on medium screens by ensuring the paragraphs are horizontally centered (with space distributed evenly around them).

Before:

features page before

After:

features page after


fix(docs-infra): fix styling of `<code>` elements on older browsers (click to expand)

Previously, styling of <code> elements utilized the :not() CSS pseudo-class with multiple selectors (:not(h1, h2, ...)). It turns out that older browsers (such as IE11) do not support multiple selectors in a single :not() instance.
(See MDN and CanIUse for more info.)

This commit fixes <code> styling to use multiple separate :not() instances instead (:not(h1):not(h2)...), so that they are styled correctly on older browsers as well.

NOTE:
This change seems to trigger some kind of bug in LightHouse that causes the a11y score of /start to be calculated as 0 (which is clearly wrong). This happens on Linux (tested on CI and locally using the Windows Subsystem for Linux (WSL)) - on Windows the score is computed correctly as 98/100.
(Example failure)

The bug seems to be related to the layout of the content and goes away if we change the viewport size (for example, switching to LightHouse's desktop config) or make another change that affects the content's layout (for example, reducing the padding of <code> elements).

To work around the issue, this commit updates the test-aio-a11y.js script to test /start-routing instead of /start.


fix(docs-infra): fix `<code>` styling in the "Cheat sheet" guide (click to expand)

Since #40944, <code> elements have a distinctive background to make them stand out from regular text. However, this styling is not desirable in certain cells of the "Cheat sheet" guide's tables, which exclusively contain code.

This commit updates the <code> styling to remove the distinctive background in those "Cheat sheet" cells.

Before #40944:

cheatsheet code before PR 40944

Since #40944:

cheatsheet code since PR 40944

After this commit:

cheatsheet code after


refactor(docs-infra): remove unnecessary wrapper `<div>` from the "Cheat sheet" guide (click to expand)

This commit removes an unnecessary wrapper <div> from the "Cheat sheet" guide. The CSS styles that referenced the element's ID (#cheatsheet) have been updated to use .page-guide-cheatsheet instead.


fix(docs): fix indentation of code snippets in the "Cheat sheet" guide (click to expand)

Previously, the indentation of code snippets in the "Cheat sheet" guide was done using regular spaces. However, leading whitespace is ignored in HTML elements (by default), which resulted in the identation being lost.

This commit fixes this by using the &emsp; HTML entity for indentation, ensuring the code snippets are easier to read.

Some examples:

Before:

cheatsheet code indentation before

After:

cheatsheet code since PR 40944


refactor(docs-infra): fix code indentation in `ContributorListComponent`'s template (click to expand)

This commit fixes the indentation of the template of ContributorListComponent to make it more readable.


refactor(docs-infra): use more consistent content width on marketing pages (click to expand)

Previously, each marketing page used a different limit for its content's width (if it had a limit at all) and implemented the width limiting in a different way. Besides resulting in an inconsistent UX, this also made it difficult to apply site-wide layout changes.

This commit makes the limit for most marketing pages consistent and uses the same CSS class to make it easier to apply site-wide changes in the future. The chosen limit is slightly larger than that of docs pages (62.5em/1000px vs 50em/800px), because marketing pages have a different type of content and layout (i.e. images, multi-column layout, etc.). Finally, this commit also removes obsolete wrapper elements, CSS classes and CSS styles, that are no longer necessary after the changes.

Notably, the homepage (/) and the "Contributors" page (/about) have remained unchanged, because the former has its own layout that is different from other marketing pages and the latter would offer a worse UX with a small content width limit (as the one used on other marketing pages).

The content widths of the rest of the marketing pages change slightly as a result of the changes in this commit, but not in a way that would have a negative impact on UX. More specifically:

Page (URL) Size before Size after
/contribute 880px 1000px
/events unlimited 1000px
/features 996px 1000px
/presskit 800px 1000px
/resources 800px 1000px

fix(docs-infra): limit max content width on "Contributors" and "Cheat sheet" pages (click to expand)

Previously, the content width on the "Contributors" page (/about) and the "Cheat sheet" guide (/guide/cheatsheet) was unlimited (i.e. the content would take up all the available space horizontally). This was not very ergonomic on large screens. Especially on the "Cheat sheet" guide there was a lot of unnecessary whitespace between the code shown on the left column and the description shown on the right column.

This commit fixes this by setting a max content width for both pages of 84em (1404px by default). This keeps the content at a more manageable width and avoids unnecessary whitespace.

Before (contributors):

contributors page on 2500px before

Before (cheatsheet):

cheatsheet on 2500px before

After (contributors):

contributors page on 2500px after

After (cheatsheet):

cheatsheet on 2500px after


fix(docs-infra): show ellipsis when text overflows in API list items (click to expand)

Previously, when an API list item's text overflowed its container, it was just hidden. This made it often difficult to realize that there was more text.

This commit fixes this by ensuring an ellipsis (...) is shown when the text overflows.

Before:

api-list truncated before

After:

api-list truncated after


fix(docs-infra): avoid truncating several API list items (click to expand)

Previously, with the min width of 220px per item, several API list items were truncated.

This commit increases the min width per item to 330px, which allows almost all items to have their full text shown. It also increases the API list page's max content width from 50em (800px) to 62.5em (1000px) to allow items to be shown on three columns despite their increased width. This increase in the content width shouldn't negatively affect UX, since the API list page uses a multi-column layout (i.e. it does not contain 1000px-lines of text.)

Before:

api-list before

After:

api-list after


New commits to address review feedback:

fix(docs-infra): improve the layout of the "Features" page on medium screens (click to expand)

The "Features" page organizes features in groups/rows of 3 features each. On wide screens, all 3 paragraphs of a group/row can be shown next to each other. On narrow screens (between 768px and 1057px), the layout changes to stack the paragraphs vertically. On medium screens, however, there is not enough space to show more than two paragraphs next to each other.

Previously, the 3rd paragraph was wrapped over to the next line.

This commit improves the layout on medium screens by switching to immediately stacking the paragraphs vertically as soon as there is not enough space for them to be displayed in one row. Since the total width is still too much for one paragraph, the paragraphs are limited to 80% of the total width.

Before (on 1000px width):

features page (on 1000px) before

After (on 1000px width):

features page (on 1000px) after


refactor(docs-infra): simplify code snippet indentation in the "Cheat sheet" guide (click to expand)

Previously, the indentation of code snippets in the "Cheat sheet" guide was done using <br> elements (for line breaks) and &emsp; HTML entities (for space). This was laborious and put the onus on the author to remember to use these symbols (instead of regular whitespace characters).
(Discussed in #41051 (comment).)

This commit changes the way <code> elements are styles inside the "Cheat sheet" guide to allow using regular whitespace characters in code snippets. It also changes all <br>/&emsp; occurrences to \n/ respectively to make code snippets more readable in the source code.

@gkalpak gkalpak added type: bug/fix action: review The PR is still awaiting reviews from at least one requested reviewer refactoring Issue that involves refactoring or code-cleanup comp: docs-infra target: patch This PR is targeted for the next patch release labels Mar 2, 2021
@gkalpak gkalpak added this to the docs-infra-aio-app milestone Mar 2, 2021
@pullapprove
pullapprove Bot requested review from jessicajaniuk and mgechev March 2, 2021 14:33
@google-cla google-cla Bot added the cla: yes label Mar 2, 2021
@gkalpak
gkalpak force-pushed the fix-aio-styles-6 branch from 39baf00 to 26b1233 Compare March 2, 2021 14:41
@mary-poppins

Copy link
Copy Markdown

@petebacondarwin petebacondarwin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generally looks good - I had a couple of non-blocking questions/suggestions.

Comment thread aio/src/styles/2-modules/_presskit.scss Resolved
Comment thread aio/src/styles/2-modules/_features.scss Resolved
Comment thread aio/content/guide/cheatsheet.md Resolved
@mary-poppins

Copy link
Copy Markdown

@jessicajaniuk jessicajaniuk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🍪

Thanks for doing this!

@jessicajaniuk
jessicajaniuk removed their request for review March 3, 2021 18:08
@petebacondarwin

Copy link
Copy Markdown
Contributor

There is something funny going on with the Lighthouse score of /start.

@petebacondarwin petebacondarwin added action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 3, 2021
@gkalpak

gkalpak commented Mar 3, 2021

Copy link
Copy Markdown
Member Author

Yeah, I noticed that. It passes locally for me and that page has hardly changed at all in this PR 🤷‍♂️
I am looking into it...

@gkalpak
gkalpak force-pushed the fix-aio-styles-6 branch from 8fbd474 to 5c1f1f4 Compare March 4, 2021 13:54
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
)

Previously, in contrast to docs pages, marketing pages had a non-fixed
top-menu, which meant that the top-menu would scroll out of the viewport
along with the rest of the content. This had a couple of downsides:
- The UI was different between pages (i.e. different top-menu behavior
  on docs vs marketing pages).
- Since some of the marketing pages are long, it was not easy for people
  to navigate to a different page (i.e. they had to scroll all the way
  back up).

This commit improves the UX by using the same, fixed top-menu on all
pages, which restores consistency and allows the user to navigate around
more easily.

NOTE:
The old behavior (non-fixed top-menu) is kept on the homepage, since its
top-menu design in a little different than other pages (e.g. it uses a
transparent top-menu) and would not play well with a fixed top-menu.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…screens (#41051)

The "Features" page organizes features in groups/rows of 3 features
each. On wide screens, all 3 paragraphs of a group/row can be shown next
to each other. On narrow screens, the layout changes to stack the
paragraphs vertically. On medium screens, however, the 3rd paragragh is
wrapped over to the next line.

Previously, the wrapped content was left-aligned, which left a lot of
empty space on the right.

This commit improves the layout on medium screens by ensuring the
paragraphs are horizontally centered (with space distributed evenly
around them).

Before: ![features page before][1]
After: ![features page after][2]

[1]: https://user-images.githubusercontent.com/8604205/109344670-b64ef000-7877-11eb-9013-890562ff2f3d.png
[2]: https://user-images.githubusercontent.com/8604205/109344678-b7801d00-7877-11eb-9224-d7715f7d7235.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…41051)

Previously, styling of `<code>` elements utilized the `:not()` CSS
pseudo-class with multiple selectors (`:not(h1, h2, ...)`). It turns out
that older browsers (such as IE11) do not support multiple selectors in
a single `:not()` instance.
(See [MDN][1] and [CanIUse][2] for more info.)

This commit fixes `<code>` styling to use multiple separate `:not()`
instances instead (`:not(h1):not(h2)...`), so that they are styled
correctly on older browsers as well.

NOTE:
This change seems to trigger some kind of bug in LightHouse that causes
the a11y score of `/start` to be calculated as 0 (which is clearly
wrong). This happens on Linux (tested on CI and locally using the
Windows Subsystem for Linux (WSL)) - on Windows the score is computed
correctly as 98/100.
([Example failure][3])

The bug seems to be related to the layout of the content and goes away
if we change the viewport size (for example, switching to LightHouse's
`desktop` config) or make another change that affects the content's
layout (for example, reducing the padding of `<code>` elements).

To work around the issue, this commit updates the `test-aio-a11y.js`
script to test `/start-routing` instead of `/start`.

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/:not#description:~:text=Using%20two%20selectors
[2]: https://caniuse.com/css-not-sel-list
[3]: https://circleci.com/gh/angular/angular/931038

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
)

Since #40944, `<code>` elements have a distinctive background to make
them stand out from regular text. However, this styling is not desirable
in certain cells of the "Cheat sheet" guide's tables, which exclusively
contain code.

This commit updates the `<code>` styling to remove the distinctive
background in those "Cheat sheet" cells.

Before #40944: ![cheatsheet code before PR 40944][1]
Since #40944: ![cheatsheet code since PR 40944][2]
After this commit: ![cheatsheet code after][3]

[1]: https://user-images.githubusercontent.com/8604205/109383633-4f215200-78f0-11eb-95e2-2a2c4fb3a31f.png
[2]: https://user-images.githubusercontent.com/8604205/109383634-50527f00-78f0-11eb-8c48-ff5f96918c4d.png
[3]: https://user-images.githubusercontent.com/8604205/109383635-50eb1580-78f0-11eb-9cf2-98851692ddd9.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…eat sheet" guide (#41051)

This commit removes an unnecessary wrapper `<div>` from the
"Cheat sheet" guide. The CSS styles that referenced the element's ID
(`#cheatsheet`) have been updated to use `.page-guide-cheatsheet`
instead.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…1051)

Previously, the indentation of code snippets in the "Cheat sheet" guide
was done using regular spaces. However, leading whitespace is ignored in
HTML elements (by default), which resulted in the identation being lost.

This commit fixes this by using the `&emsp;` HTML entity for
indentation, ensuring the code snippets are easier to read.

Some examples:

Before: ![cheatsheet code indentation before][1]
After: ![cheatsheet code since PR 40944][2]

[1]: https://user-images.githubusercontent.com/8604205/109385242-218dd600-78fb-11eb-9261-18ab5f2c308c.png
[2]: https://user-images.githubusercontent.com/8604205/109385246-25b9f380-78fb-11eb-8e82-d8a561deba21.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…nt`'s template (#41051)

This commit fixes the indentation of the template of
`ContributorListComponent` to make it more readable.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…pages (#41051)

Previously, each marketing page used a different limit for its content's
width (if it had a limit at all) and implemented the width limiting in a
different way. Besides resulting in an inconsistent UX, this also made
it difficult to apply site-wide layout changes.

This commit makes the limit for most marketing pages consistent and uses
the same CSS class to make it easier to apply site-wide changes in the
future. The chosen limit is slightly larger than that of docs pages
(62.5em/1000px vs 50em/800px), because marketing pages have a different
type of content and layout (i.e. images, multi-column layout, etc.).
Finally, this commit also removes obsolete wrapper elements, CSS classes
and CSS styles, that are no longer necessary after the changes.

Notably, the homepage (`/`) and the "Contributors" page (`/about`) have
remained unchanged, because the former has its own layout that is
different from other marketing pages and the latter would offer a worse
UX with a small content width limit (as the one used on other marketing
pages).

The content widths of the rest of the marketing pages change slightly as
a result of the changes in this commit, but not in a way that would have
a negative impact on UX. More specifically:

| Page (URL)    | Size before | Size after |
|:--------------|------------:|-----------:|
| `/contribute` |       880px |     1000px |
| `/events`     |   unlimited |     1000px |
| `/features`   |       996px |     1000px |
| `/presskit`   |       800px |     1000px |
| `/resources`  |       800px |     1000px |

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
… sheet" pages (#41051)

Previously, the content width on the "Contributors" page (`/about`) and
the "Cheat sheet" guide (`/guide/cheatsheet`) was unlimited (i.e. the
content would take up all the available space horizontally). This was
not very ergonomic on large screens. Especially on the "Cheat sheet"
guide there was a lot of unnecessary whitespace between the code shown
on the left column and the description shown on the right column.

This commit fixes this by setting a max content width for both pages of
84em (1404px by default). This keeps the content at a more manageable
width and avoids unnecessary whitespace.

Before (contributors): ![contributors page on 2500px before][1]
Before (cheatsheet): ![cheatsheet on 2500px before][2]
After (contributors): ![contributors page on 2500px after][3]
After (cheatsheet): ![cheatsheet on 2500px after][4]

[1]: https://user-images.githubusercontent.com/8604205/109394323-1bb1e800-792f-11eb-9cd6-c5b83e5ae921.png
[2]: https://user-images.githubusercontent.com/8604205/109394329-1fde0580-792f-11eb-91c0-4ed7ad408b17.png
[3]: https://user-images.githubusercontent.com/8604205/109394319-181e6100-792f-11eb-9463-a281dfe80448.png
[4]: https://user-images.githubusercontent.com/8604205/109394330-210f3280-792f-11eb-9837-ddc7a8d01d19.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…41051)

Previously, when an API list item's text overflowed its container, it
was just hidden. This made it often difficult to realize that there was
more text.

This commit fixes this by ensuring an ellipsis (`...`) is shown when the
text overflows.

Before: ![api-list truncated before][1]
After: ![api-list truncated after][2]

[1]: https://user-images.githubusercontent.com/8604205/109396186-0cd03300-7939-11eb-921c-00621a3889a4.png
[2]: https://user-images.githubusercontent.com/8604205/109396187-0e016000-7939-11eb-9f3b-4535be083417.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
Previously, with the min width of 220px per item, several API list items
were truncated.

This commit increases the min width per item to 330px, which allows
almost all items to have their full text shown. It also increases the
API list page's max content width from 50em (800px) to 62.5em (1000px)
to allow items to be shown on three columns despite their increased
width. This increase in the content width shouldn't negatively affect
UX, since the API list page uses a multi-column layout (i.e. it does not
contain 1000px-lines of text.)

Before: ![api-list before][1]
After: ![api-list after][2]

[1]: https://user-images.githubusercontent.com/8604205/109396457-5f5e1f00-793a-11eb-80cf-1418f409325a.png
[2]: https://user-images.githubusercontent.com/8604205/109396659-499d2980-793b-11eb-95d3-f54250f7fab5.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…screens (#41051)

The "Features" page organizes features in groups/rows of 3 features
each. On wide screens, all 3 paragraphs of a group/row can be shown next
to each other. On narrow screens (between 768px and 1057px), the layout
changes to stack the paragraphs vertically. On medium screens, however,
there is not enough space to show more than two paragraphs next to each
other.

Previously, the 3rd paragraph was wrapped over to the next line.

This commit improves the layout on medium screens by switching to
immediately stacking the paragraphs vertically as soon as there is not
enough space for them to be displayed in one row. Since the total width
is still too much for one paragraph, the paragraphs are limited to 80%
of the total width.

Before (on 1000px width): [features page (on 1000px) before][1]
After (on 1000px width): [features page (on 1000px) after][2]

[1]: https://user-images.githubusercontent.com/8604205/109825316-62128a00-7c42-11eb-8391-650201257274.png
[2]: https://user-images.githubusercontent.com/8604205/109825323-6343b700-7c42-11eb-86c1-e8307c5a727a.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
… sheet" guide (#41051)

Previously, the indentation of code snippets in the "Cheat sheet" guide
was done using `<br>` elements (for line breaks) and `&emsp;` HTML
entities (for space). This was laborious and put the onus on the author
to remember to use these symbols (instead of regular whitespace
characters).
(Discussed in
#41051 (comment).)

This commit changes the way `<code>` elements are styles inside the
"Cheat sheet" guide to allow using regular whitespace characters in code
snippets. It also changes all `<br>`/`&emsp;` occurrences to `\n`/`  `
respectively to make code snippets more readable in the source code.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
)

Previously, in contrast to docs pages, marketing pages had a non-fixed
top-menu, which meant that the top-menu would scroll out of the viewport
along with the rest of the content. This had a couple of downsides:
- The UI was different between pages (i.e. different top-menu behavior
  on docs vs marketing pages).
- Since some of the marketing pages are long, it was not easy for people
  to navigate to a different page (i.e. they had to scroll all the way
  back up).

This commit improves the UX by using the same, fixed top-menu on all
pages, which restores consistency and allows the user to navigate around
more easily.

NOTE:
The old behavior (non-fixed top-menu) is kept on the homepage, since its
top-menu design in a little different than other pages (e.g. it uses a
transparent top-menu) and would not play well with a fixed top-menu.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…screens (#41051)

The "Features" page organizes features in groups/rows of 3 features
each. On wide screens, all 3 paragraphs of a group/row can be shown next
to each other. On narrow screens, the layout changes to stack the
paragraphs vertically. On medium screens, however, the 3rd paragragh is
wrapped over to the next line.

Previously, the wrapped content was left-aligned, which left a lot of
empty space on the right.

This commit improves the layout on medium screens by ensuring the
paragraphs are horizontally centered (with space distributed evenly
around them).

Before: ![features page before][1]
After: ![features page after][2]

[1]: https://user-images.githubusercontent.com/8604205/109344670-b64ef000-7877-11eb-9013-890562ff2f3d.png
[2]: https://user-images.githubusercontent.com/8604205/109344678-b7801d00-7877-11eb-9224-d7715f7d7235.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…41051)

Previously, styling of `<code>` elements utilized the `:not()` CSS
pseudo-class with multiple selectors (`:not(h1, h2, ...)`). It turns out
that older browsers (such as IE11) do not support multiple selectors in
a single `:not()` instance.
(See [MDN][1] and [CanIUse][2] for more info.)

This commit fixes `<code>` styling to use multiple separate `:not()`
instances instead (`:not(h1):not(h2)...`), so that they are styled
correctly on older browsers as well.

NOTE:
This change seems to trigger some kind of bug in LightHouse that causes
the a11y score of `/start` to be calculated as 0 (which is clearly
wrong). This happens on Linux (tested on CI and locally using the
Windows Subsystem for Linux (WSL)) - on Windows the score is computed
correctly as 98/100.
([Example failure][3])

The bug seems to be related to the layout of the content and goes away
if we change the viewport size (for example, switching to LightHouse's
`desktop` config) or make another change that affects the content's
layout (for example, reducing the padding of `<code>` elements).

To work around the issue, this commit updates the `test-aio-a11y.js`
script to test `/start-routing` instead of `/start`.

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/:not#description:~:text=Using%20two%20selectors
[2]: https://caniuse.com/css-not-sel-list
[3]: https://circleci.com/gh/angular/angular/931038

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
)

Since #40944, `<code>` elements have a distinctive background to make
them stand out from regular text. However, this styling is not desirable
in certain cells of the "Cheat sheet" guide's tables, which exclusively
contain code.

This commit updates the `<code>` styling to remove the distinctive
background in those "Cheat sheet" cells.

Before #40944: ![cheatsheet code before PR 40944][1]
Since #40944: ![cheatsheet code since PR 40944][2]
After this commit: ![cheatsheet code after][3]

[1]: https://user-images.githubusercontent.com/8604205/109383633-4f215200-78f0-11eb-95e2-2a2c4fb3a31f.png
[2]: https://user-images.githubusercontent.com/8604205/109383634-50527f00-78f0-11eb-8c48-ff5f96918c4d.png
[3]: https://user-images.githubusercontent.com/8604205/109383635-50eb1580-78f0-11eb-9cf2-98851692ddd9.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…eat sheet" guide (#41051)

This commit removes an unnecessary wrapper `<div>` from the
"Cheat sheet" guide. The CSS styles that referenced the element's ID
(`#cheatsheet`) have been updated to use `.page-guide-cheatsheet`
instead.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…1051)

Previously, the indentation of code snippets in the "Cheat sheet" guide
was done using regular spaces. However, leading whitespace is ignored in
HTML elements (by default), which resulted in the identation being lost.

This commit fixes this by using the `&emsp;` HTML entity for
indentation, ensuring the code snippets are easier to read.

Some examples:

Before: ![cheatsheet code indentation before][1]
After: ![cheatsheet code since PR 40944][2]

[1]: https://user-images.githubusercontent.com/8604205/109385242-218dd600-78fb-11eb-9261-18ab5f2c308c.png
[2]: https://user-images.githubusercontent.com/8604205/109385246-25b9f380-78fb-11eb-8e82-d8a561deba21.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…nt`'s template (#41051)

This commit fixes the indentation of the template of
`ContributorListComponent` to make it more readable.

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…pages (#41051)

Previously, each marketing page used a different limit for its content's
width (if it had a limit at all) and implemented the width limiting in a
different way. Besides resulting in an inconsistent UX, this also made
it difficult to apply site-wide layout changes.

This commit makes the limit for most marketing pages consistent and uses
the same CSS class to make it easier to apply site-wide changes in the
future. The chosen limit is slightly larger than that of docs pages
(62.5em/1000px vs 50em/800px), because marketing pages have a different
type of content and layout (i.e. images, multi-column layout, etc.).
Finally, this commit also removes obsolete wrapper elements, CSS classes
and CSS styles, that are no longer necessary after the changes.

Notably, the homepage (`/`) and the "Contributors" page (`/about`) have
remained unchanged, because the former has its own layout that is
different from other marketing pages and the latter would offer a worse
UX with a small content width limit (as the one used on other marketing
pages).

The content widths of the rest of the marketing pages change slightly as
a result of the changes in this commit, but not in a way that would have
a negative impact on UX. More specifically:

| Page (URL)    | Size before | Size after |
|:--------------|------------:|-----------:|
| `/contribute` |       880px |     1000px |
| `/events`     |   unlimited |     1000px |
| `/features`   |       996px |     1000px |
| `/presskit`   |       800px |     1000px |
| `/resources`  |       800px |     1000px |

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
… sheet" pages (#41051)

Previously, the content width on the "Contributors" page (`/about`) and
the "Cheat sheet" guide (`/guide/cheatsheet`) was unlimited (i.e. the
content would take up all the available space horizontally). This was
not very ergonomic on large screens. Especially on the "Cheat sheet"
guide there was a lot of unnecessary whitespace between the code shown
on the left column and the description shown on the right column.

This commit fixes this by setting a max content width for both pages of
84em (1404px by default). This keeps the content at a more manageable
width and avoids unnecessary whitespace.

Before (contributors): ![contributors page on 2500px before][1]
Before (cheatsheet): ![cheatsheet on 2500px before][2]
After (contributors): ![contributors page on 2500px after][3]
After (cheatsheet): ![cheatsheet on 2500px after][4]

[1]: https://user-images.githubusercontent.com/8604205/109394323-1bb1e800-792f-11eb-9cd6-c5b83e5ae921.png
[2]: https://user-images.githubusercontent.com/8604205/109394329-1fde0580-792f-11eb-91c0-4ed7ad408b17.png
[3]: https://user-images.githubusercontent.com/8604205/109394319-181e6100-792f-11eb-9463-a281dfe80448.png
[4]: https://user-images.githubusercontent.com/8604205/109394330-210f3280-792f-11eb-9837-ddc7a8d01d19.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…41051)

Previously, when an API list item's text overflowed its container, it
was just hidden. This made it often difficult to realize that there was
more text.

This commit fixes this by ensuring an ellipsis (`...`) is shown when the
text overflows.

Before: ![api-list truncated before][1]
After: ![api-list truncated after][2]

[1]: https://user-images.githubusercontent.com/8604205/109396186-0cd03300-7939-11eb-921c-00621a3889a4.png
[2]: https://user-images.githubusercontent.com/8604205/109396187-0e016000-7939-11eb-9f3b-4535be083417.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
Previously, with the min width of 220px per item, several API list items
were truncated.

This commit increases the min width per item to 330px, which allows
almost all items to have their full text shown. It also increases the
API list page's max content width from 50em (800px) to 62.5em (1000px)
to allow items to be shown on three columns despite their increased
width. This increase in the content width shouldn't negatively affect
UX, since the API list page uses a multi-column layout (i.e. it does not
contain 1000px-lines of text.)

Before: ![api-list before][1]
After: ![api-list after][2]

[1]: https://user-images.githubusercontent.com/8604205/109396457-5f5e1f00-793a-11eb-80cf-1418f409325a.png
[2]: https://user-images.githubusercontent.com/8604205/109396659-499d2980-793b-11eb-95d3-f54250f7fab5.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
…screens (#41051)

The "Features" page organizes features in groups/rows of 3 features
each. On wide screens, all 3 paragraphs of a group/row can be shown next
to each other. On narrow screens (between 768px and 1057px), the layout
changes to stack the paragraphs vertically. On medium screens, however,
there is not enough space to show more than two paragraphs next to each
other.

Previously, the 3rd paragraph was wrapped over to the next line.

This commit improves the layout on medium screens by switching to
immediately stacking the paragraphs vertically as soon as there is not
enough space for them to be displayed in one row. Since the total width
is still too much for one paragraph, the paragraphs are limited to 80%
of the total width.

Before (on 1000px width): [features page (on 1000px) before][1]
After (on 1000px width): [features page (on 1000px) after][2]

[1]: https://user-images.githubusercontent.com/8604205/109825316-62128a00-7c42-11eb-8391-650201257274.png
[2]: https://user-images.githubusercontent.com/8604205/109825323-6343b700-7c42-11eb-86c1-e8307c5a727a.png

PR Close #41051
AndrewKushnir pushed a commit that referenced this pull request Mar 9, 2021
… sheet" guide (#41051)

Previously, the indentation of code snippets in the "Cheat sheet" guide
was done using `<br>` elements (for line breaks) and `&emsp;` HTML
entities (for space). This was laborious and put the onus on the author
to remember to use these symbols (instead of regular whitespace
characters).
(Discussed in
#41051 (comment).)

This commit changes the way `<code>` elements are styles inside the
"Cheat sheet" guide to allow using regular whitespace characters in code
snippets. It also changes all `<br>`/`&emsp;` occurrences to `\n`/`  `
respectively to make code snippets more readable in the source code.

PR Close #41051
@gkalpak
gkalpak deleted the fix-aio-styles-6 branch March 9, 2021 17:40
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Apr 9, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes refactoring Issue that involves refactoring or code-cleanup target: patch This PR is targeted for the next patch release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants