1031 Commits

Author SHA1 Message Date
George Kalpakas 0c9d33cb51 refactor(docs-infra): replace use of deprecated Compiler with createNgModuleRef() (#44293)
Remove a use of the deprecated `Compiler` class in `ElementsLoader` and
use the `createNgModuleRef()` function instead.

PR Close #44293
2021-12-01 11:56:47 -08:00
George Kalpakas 98c1d91759 refactor(docs-infra): remove obsolete ViewEngine code path from ElementsLoader (#44293)
Remove a code path that was only reached in ViewEngine mode and is now
(with the removal of ViewEngine) obsolete.

PR Close #44293
2021-12-01 11:56:47 -08:00
Kristiyan Kostadinov c92095c201 refactor(docs-infra): clean up entryComponents usages (#44257)
Cleans up some usages of `entryComponents` from AIO.

PR Close #44257
2021-11-30 13:49:46 -05:00
George Kalpakas efd329f063 fix(docs-infra): fix the main content layout (#44282)
Fix the layout of the main docs content on both small and large screens.
On small screens, content could overlap with the floating ToC, while on
large screens the content was not centered correctly (see screenshots
below).

(For reference, this was accidentally broken in #44236.)

**Before:**
- ![content on small screen before](https://user-images.githubusercontent.com/8604205/143491577-97255ee7-f79d-4c95-9287-ff2afeb5b29d.png)
- ![content on large screen before](https://user-images.githubusercontent.com/8604205/143491582-2c19f7a2-d5ad-475a-a58b-e449efc492a9.png)

**After:**
- ![content on small screen after](https://user-images.githubusercontent.com/8604205/143491580-a405f650-cd4a-4804-8e65-422fc91f4c6e.png)
- ![content on large screen after](https://user-images.githubusercontent.com/8604205/143491585-d0d2e914-a1a2-45ba-8e6b-b9546aa80354.png)

PR Close #44282
2021-11-29 17:21:14 -05:00
dario-piotrowicz 90db2b0355 fix(docs-infra): add safari-only media query for aio footer flex (#44266)
safari handles rem based media queries differently so in order to
provide a similar user-experience to safari users, add a new
safari-only media query for the footer's flex container

resolves #44242

PR Close #44266
2021-11-29 12:37:44 -05:00
Pete Bacon Darwin 101b2cc6e5 fix(docs-infra): ensure deprecated styling is not overridden (#44275)
The `.code-anchor` styling was overriding the `.deprecated-api-item` styling.
The `text-decoration` is not needed on `.code-anchor` since it inherits this from the `a` rule in the typography.scss file.

Fixes #44264

PR Close #44275
2021-11-29 12:36:23 -05:00
dario-piotrowicz b9362f088e fix(docs-infra): move aio footer inside mat-sidenav-container (#44236)
currently the aio footer sits outside the mat-sidenav-container, as a
result when the mat-sidenav in over mode appears, the footer is not
placed under the sidenav backdrop, move the footer inside the
mat-sidenav-container so that it does

PR Close #44236
2021-11-24 17:04:01 +00:00
dario-piotrowicz 69f25bd687 fix(docs-infra): remove negative margin (#44126)
remove the top padding for the homepage article, instead of
having that top padding and moving the element up via a
negative bottom margin in the intro section

note: the result is identical except for when the article's media query
is applied, the difference is barely noticeable anyways

PR Close #44126
2021-11-19 19:32:29 +00:00
dario-piotrowicz 541a87d489 fix(docs-infra): fix aio homepage breaking on certain widths (#44126)
the aio homepage has a fixed width for its hero content,
that is not handling well certain window widths, fix that by removing
the fixed width and tweaking related media queries

PR Close #44126
2021-11-19 19:32:29 +00:00
Paul Gschwendtner f477d0cc55 build(docs-infra): update AIO to angular framework/components/cli final RCs (#44030)
Updates AIO to the latest v13 release-candidate version of all
Angular-owned packages, such as Angular CDK and Angular Material.

Applies changes needed for the v13 CLI as performed by the CLI
through `ng update`:

https://github.com/angular/angular-cli/tree/7ff8c5350ea2e49574dd659adae02215957d2685/packages/schematics/angular/migrations/update-13.

Additionally, the web components polyfill has been removed as all browsers
supported by Angular seem to support custom elements v1 natively, according to:

* https://caniuse.com/custom-elementsv1
* https://www.webcomponents.org/ (scroll down to browser support)

Co-authored-by: George Kalpakas <kalpakas.g@gmail.com>

PR Close #44030
2021-11-08 16:59:47 +00:00
mgechev 42034bc95f docs: update the survey expiry date (#44021)
PR Close #44021
2021-11-04 18:55:24 +00:00
Joey Perrott ea77439d25 fix(docs-infra): remove tilda from scss imports in aio (#44046)
Remove tilda usages.

PR Close #44046
2021-11-03 16:37:11 -07:00
Alan Agius 9c99afdc7c fix(docs-infra): search box input line-height (#43983)
This fixes an issue on Safari which caused the text to be pushed down when blurring out of the search input field. The root cause of the problem appears to be that previously the computed line height was that of 32px, which caused a shift in content.

Closes #43935

PR Close #43983
2021-10-29 15:47:09 -07:00
George Kalpakas 494d056c48 refactor(docs-infra): remove obsolete way of disabling DocViewer animations (#43977)
Previously, there were two ways to disable view transition animations in
`DocViewerComponent`: Using a `.no-animations` CSS class on the
`<aio-doc-viewer>` element and setting the static
`DocViewerComponent.animationsEnabled` property to `false`. The latter
was only used to disable animations for testing purposes.

With the recent introduction of `AppComponent.reducedMotion`, there is
now an easy way to disable animations in tests using the
`.no-animations` class (which is applied by `AppComponent` based on the
value of `AppComponent.reducedMotion`). Therefore, it is no longer
necessary to have `DocViewerComponent.animationEnabled`.

This commit removes the now obsolete `animationsEnalbed` property.

PR Close #43977
2021-10-29 15:45:02 -07:00
George Kalpakas 22c5f35a8c fix(docs-infra): improve accessibility by respecting prefers-reduced-motion (#43977)
Make the app easier to use for people with motion sensitivities by
disabling several animations (esp. ones involving moving things around)
when the user prefers reduced motion. The user's preference is detected
using the [prefers-reduced-motion][1] CSS media feature.

Disabled animations include:
- View fade in/out transitions.
- Sidenav open/close animations.
- Top-menu color and size changes.
- Contributor cards flip animations.

For more details on using `prefers-reduced-motion` and disabling
Angular animations see:
- [Designing with reduced motion for motion sensitivities][2]
- [Disabling Angular animations at runtime][3]

[1]: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion
[2]: https://www.smashingmagazine.com/2020/09/design-reduced-motion-sensitivities/
[3]: https://dev.to/this-is-angular/disabling-angular-animations-at-runtime-9a6

PR Close #43977
2021-10-29 15:45:02 -07:00
George Kalpakas 50b2d273b8 refactor(docs-infra): convert deploy-to-firebase script to ESM (#43963)
Convert the `deploy-to-firebase` script (and corresponding tests) from
CommonJS format to ESM.

PR Close #43963
2021-10-29 15:05:10 -07:00
George Kalpakas 2fa48e5f88 refactor(docs-infra): move deploy-to-firebase.js into a dedicated directory (#43963)
This commit moves the `aio/scripts/deploy-to-firebase.js` script into a
new directory, `aio/scripts/deploy-to-firebase/`. This will make it
easier to break it up into multiple smaller files to better organize the
code (without polluting the `aio/scripts/` directory).

PR Close #43963
2021-10-29 15:05:10 -07:00
dario-piotrowicz ebc9b55dcf fix(docs-infra): add paddings to docs-card titles (#43859)
improve the aio docs-card title by adding some padding
so that it doesn't get too close to the card's edges

PR Close #43859
2021-10-18 09:23:19 -07:00
dario-piotrowicz 7e5268174b fix(docs-infra): apply minor style fixes to aio contributor cards (#43844)
improve the aio contributors card by aligning centrally the
contributor's name and adding some padding so that it doesn't
get too close to the card's edges

Note: the name's aligning was already present by wrongly removed in
PR #43355

PR Close #43844
2021-10-15 10:12:59 -07:00
dario-piotrowicz 663690fc86 fix(docs-infra): improve cancel icon in top-menu search (#43600)
webkit browsers show a cancel X icon in the input search on focus/hover
which allows to clear the content of the input, such icon has small
glitches/imperfections so use a mat-icon instead

(this also adds such icon to non-webkit browsers)

PR Close #43600
2021-10-12 17:50:30 +00:00
George Kalpakas 7778cb3680 fix(docs-infra): ensure SwUpdatesService is instantiated (#43766)
In 305d05545a, we accidentally stopped
instantiating the `SwUpdatesService` service, which meant that we were
no longer subscribing to ServiceWorker update events and proactively
checking for updates. We would still gets updates, because the
ServiceWorker automatically checks on each navigation request and when a
new ServiceWorker instance is created, but we would not proactively
fetch updates and also miss `unrecoverable` errors.

This commit fixes this by exposing an `enable()` method from
`SwUpdatesService`, which has to be explicitly called for the service to
be enabled, and ensures that the method is called when `AppComponent` is
initialized.
The commit also gets rid of the `SwUpdatesModule` (whose only purpose
was to provide `SwUpdatesService`) in favor of using `providedIn`.

Fixes #43695

PR Close #43766
2021-10-08 20:39:46 +00:00
George Kalpakas a64adabf65 fix(docs-infra): avoid prepending version info to error messages twice (#43767)
Previously, we used to prepend version info to error messages by
updating their `message` property and their `stack` property. However,
due to the fact that on some browsers `error.stack` is lazily computed
based on `error.message` the first time the `stack` property is
accessed, this resulted in prepending the version info twice.

This commit ensures that the version info is only prepended to
`error.stack` once to avoid unnecessary repetition in error messages.

PR Close #43767
2021-10-08 20:17:59 +00:00
George Kalpakas 6194696340 fix(docs-infra): fix Sass rule resulting in invalid CSS (#43767)
The way the Sass rule was defined previously resulted in invalid CSS of
the form:
```css
table > thead > { ... }
```

This, in turn, resulted in a build-time warning:
```
Warning:  > styles.9a5a35b070498c08.css:3079:14: warning: Unexpected "{"
    3079 │ table thead > {
         ╵               ^
```

This commit fixes the affected rule (mostly to avoid the warning,
because this change doesn't seem to have any visual difference). It also
fixes other rules that were currently not affected (because they only
had nested rules and no direct styles), but were susceptible to being
affected in the future.

PR Close #43767
2021-10-08 20:17:59 +00:00
hchiam f8ae6ff08e docs(docs-infra): fix a11y of external links (#43725)
prevent screen readers from falsely announcing "open_in_new" since they may not actually open new tabs/windows but simply send the current page to a domain outside angular.io

Fixes #43512

PR Close #43725
2021-10-07 20:55:24 +00:00
George Kalpakas b8ab5ff0fb build(docs-infra): update AIO to align with new v13.0.0-next.9 CLI apps (#43686)
This commit updates angular.io to more closely align with new apps
created with the latest Angular CLI and remove redundant files/config
now that CLI has dropped support for differential loading.

PR Close #43686
2021-10-06 10:05:54 -07:00
George Kalpakas 81d3919102 refactor(docs-infra): prefix error messages with Angular version info (#43686)
Prefix error messages with the Angular version currently used in the
angular.io app. This applies to both errors logged to the console and
reported to Google Analytics and makes debugging certain errors easier.

PR Close #43686
2021-10-06 10:05:54 -07:00
dario-piotrowicz 6ac35d0660 fix(docs-infra): convert button-like elements to actual buttons (#43601)
some elements in the aio application are anchors or divs but behave
like buttons, it is semantically (and a11y) more correct to convert
them to actual button elements instead

PR Close #43601
2021-10-06 09:22:04 -07:00
dario-piotrowicz 2a58ff3e41 fix(docs-infra): amend color of code links inside single anchors (#43586)
when some auto code links fail to happen they can be added manually
with the md ``[`code text`](link)``, these generate anchor elements which
contain a code element, such code element does not get the correct text
color, this commit fixes such issue

PR Close #43586
2021-10-04 16:31:16 -07:00
mgechev b64f796cc7 docs: add developer survey 2021 (#43670)
PR Close #43670
2021-10-04 10:24:58 -07:00
George Kalpakas d1baf7cdfb fix(docs-infra): add a "skip to content" link for better accessibility (#43460)
Add a link at the top of the page that allows skipping directly to the
main content area. This allows people using assistive technologies to
skip navigation-related parts of the page which are presented before the
main content.

Related resources:
- [www.w3.org](https://www.w3.org/TR/WCAG20-TECHS/G1.html)
- [accessibility.oit.ncsu.edu](https://accessibility.oit.ncsu.edu/it-accessibility-at-nc-state/developers/accessibility-handbook/mouse-and-keyboard-events/skip-to-main-content)
- [css-tricks.com](https://css-tricks.com/how-to-create-a-skip-to-content-link)

---
Example implementations on other websites:

- **[accessibility.oit.ncsu.edu](https://accessibility.oit.ncsu.edu/)**:
  ![accessibility.oit.ncsu.edu](https://user-images.githubusercontent.com/8604205/133285834-db1314e6-ff71-4862-8f80-c8a9f69083d9.png)

- **[smile.amazon.com](https://smile.amazon.com/)**:
  ![smile.amazon.com](https://user-images.githubusercontent.com/8604205/133285854-1163e733-8de3-4244-bc23-5cd5a943001d.png)

- **[chase.com](https://chase.com/)**:
  ![chase.com](https://user-images.githubusercontent.com/8604205/133293396-ade9d95f-56ce-4cdc-8926-b4cd2dc6c3a5.png)

- **[css-tricks.com](https://css-tricks.com/)**:
  ![css-tricks.com](https://user-images.githubusercontent.com/8604205/133285845-702045ee-088a-40f1-bb26-21adebb02505.png)

- **[github.com/angular/angular](https://github.com/angular/angular)**:
  ![github.com/angular/angular](https://user-images.githubusercontent.com/8604205/133921259-9fd759b9-f862-47c3-b069-643912df17a1.png)

- **[news.sky.com](https://news.sky.com/)**:
  ![news.sky.com](https://user-images.githubusercontent.com/8604205/133285863-89946096-5353-4b2b-ab69-eb748bdcfe06.png)

- **[youtube.com](https://youtube.com/)**:
  ![youtube.com](https://user-images.githubusercontent.com/8604205/133921261-a68a12c1-1aea-4ad0-8457-b4eaf8ed3497.png)

---
Angular.io implementation:

- **[angular.io](https://angular.io/)**:
  ![angular.io](https://user-images.githubusercontent.com/8604205/133409634-0054625c-d14b-4ebe-bb4c-142cfc524d98.png)

Fixes #42936

PR Close #43460
2021-09-21 16:12:39 +00:00
George Kalpakas 4dd107d18c fix(docs-infra): correctly handle in-page anchor links (#43460)
Previously, anchor links that were supposed to point to fragments inside
the current page (e.g. `href="#something"`) would end up navigating to
the homepage (`/`). This was due to them being resolved relative to the
base URL, which is set to `/` (via `<base href="/">`). See also
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/base#in-page_anchors.

This commit fixes this issue by handling such links specially in
`LocationService#handleAnchorClick()` and prepending the current path to
the URL.

This will also be useful for implementing a "skip to content" link as
described in #42936.

PR Close #43460
2021-09-21 16:12:39 +00:00
George Kalpakas 235e4aaa25 fix(docs-infra): focus elements when scrolling to them (if focusable) (#43460)
When using `ScrollService#scrollToElement()` to scroll to a specific
element, also focus the element if it is focusable (i.e. if it has a
`focus()` method).

This will be useful for implementing a "skip to content" link as
described in #42936.

PR Close #43460
2021-09-21 16:12:39 +00:00
George Kalpakas 0e2ff28627 fix(docs-infra): improve accessibility of contributor cards (#43460)
Improve the accessibility of contributor cards (in `/about`) by making
them easier to navigate via keyboard:

- Show the (otherwise hidden) contributor info links on focus.
- Make the "View bio" link focusable via keyboard (to give a clearer
  indication that users can click to view the bio - although technically
  the click is handled by an ancestor).
- Make the flipped cards focusable via keyboard (so it is possible to
  click them to unflip).

PR Close #43460
2021-09-21 16:12:39 +00:00
George Kalpakas a072c96305 fix(docs-infra): improve accessibility of button groups (#43460)
Improve the accessibility of button groups (such as those seen in
`/about` and `/resources` to choose between the different categories)
by making them easier to navigate via keyboard:

- Make the individual buttons focusable via keyboard.
  (Previously, they were not focusable - despite being anchor elements,
  because they were lacking an `href` attribute.)

- Give focused buttons a different style.

PR Close #43460
2021-09-21 16:12:39 +00:00
dario-piotrowicz 80f5a4e7fb fix(docs-infra): improve aio contributors page responsiveness (#43355)
Improve the aio contributors page responsiveness regarding the browser's
font-size so that the page looks good regarding on font-size settings
(no cropped or cramped content)

PR Close #43355
2021-09-20 16:02:24 +00:00
dario-piotrowicz 66c6dbdc79 refactor(docs-infra): introduce max-len 120 eslint rule (#43439)
add the max-len rule to the aio eslintrc and fix what code
breaks such rule

PR Close #43439
2021-09-15 10:47:35 -07:00
dario-piotrowicz 4ef9d247b6 refactor(docs-infra): fix typos in app component (and its tests) (#43439)
fix some minor typos found in the app.component.ts and
app.component.spec.ts files

PR Close #43439
2021-09-15 10:47:35 -07:00
Bjarki 2670e964ec fix(docs-infra): pass a TrustedScriptURL to ServiceWorkerModule (#42800)
Fix a Trusted Types violation in ServiceWorkerModule that occurs when
initializing the service worker from a string URL, by passing a
TrustedScriptURL instead.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki a4676aa2c1 fix(docs-infra): make doc-viewer compatible with Trusted Types (#42800)
Change DocumentContents.contents to a TrustedHTML and update users
accordingly.

PR Close #42800
2021-09-09 11:17:00 -07:00
Bjarki 2b267209a1 fix(docs-infra): make custom icon registry compatible with Trusted Types (#42800)
Change SvgIconInfo.svgSource to be a TrustedHTML and update all its
users accordingly. Also introduce the svg template tag function for
building TrustedHTML from constant SVG sources.

PR Close #42800
2021-09-09 11:16:59 -07:00
Bjarki e3f5b41706 fix(docs-infra): make pretty-printer compatible with Trusted Types (#42800)
Change the PrettyPrinter interface to accept a TrustedHTML and patch
prettify.js so that it makes use of that value without modification.
Update all users of the service to produce, and pass in a TrustedHTML.

PR Close #42800
2021-09-09 11:16:59 -07:00
Bjarki d29f4ab09a fix(docs-infra): fix simple Trusted Types violations (#42800)
Also introduce a dependency on the Trusted Types type definitions and a
Trusted Types polyfill, safevalues. Create a security module for common,
security-reviewed transformations into Trusted Types.

PR Close #42800
2021-09-09 11:16:59 -07:00
Bjarki b601419cd1 fix(docs-infra): fix Trusted Types violation in Analytics snippet (#42800)
The Google Analytics snippet loads its runtime by dynamically creating a
script element and assigning a URL to its src attribute. This causes a
Trusted Types violation.

To fix this, create an inline Trusted Types policy called 'aio#analytics'
to bless the script URL, which is a trusted constant.

PR Close #42800
2021-09-09 11:16:59 -07:00
Pete Bacon Darwin e4e98edf20 build(docs-infra): add sealed markers to classes in API pages (#42807)
This change will mark classes as `sealed` unless they have been annotated
with an `@extensible` jsdoc tag.

Fixes #42802

PR Close #42807
2021-08-17 09:23:09 -07:00
George Kalpakas 6c3ad1f1a4 fix(docs-infra): correctly detect chunk load errors (#43088)
It seems that at some point (potentially with the switch to Webpack 5)
Webpack started using the full chunk name (instead of just a numeric
identifier) in `ChunkLoadError` messages. So the error messages changed
from:
```
ChunkLoadError: Loading chunk 2 failed.
```

...to:
```
ChunkLoadError: Loading chunk src_app_something_some_module_ts failed.
```

This commit updates the regex that is used to detect such errors (in
order to print ServiceWorker-related debug info) to correctly recognize
the new error message format.

PR Close #43088
2021-08-09 12:25:41 -07:00
George Kalpakas 85e93c3833 fix(docs-infra): notify ErrorHandler of UnrecoverableState errors (#42941)
With this commit, the `ErrorHandler` is notified of ServiceWorker
`UnrecoverableState` errors. The main purpose of this change is
gathering info about the occurrence (and frequency) of such errors in
Google analytics.

PR Close #42941
2021-07-27 09:23:14 -07:00
George Kalpakas e2aa7652e5 fix(docs-infra): fix keyword color in CLI pages code blocks (#42889)
Previously, names of CLI commands that also happened to be keywords were
shown in black color in the code block demonstrating the command's
usage. This worked fine when in light mode (where the code block
background is white) but not in the recently introduced dark mode (where
the code block background is dark gray).

This commit fixes this by ensuring the `.kwd` token color is inherited
from its parent (which has an appropriate color for the current theme).
Previously, the `.kwd` token was reset to its initial value (which is
`black` regardless of the theme).

**Before:** ![CLI pages keyword before][1]
**After:** ![cli-pages-keyword after][2]

[1]: https://user-images.githubusercontent.com/8604205/126073803-af317f0c-d04f-4c3a-9a83-e92541d7dd5a.png
[2]: https://user-images.githubusercontent.com/8604205/126073806-1d57e3ed-90b1-4735-ae2a-d0a39862bb95.png

PR Close #42889
2021-07-20 11:56:33 -07:00
dario-piotrowicz ca7d4c3403 refactor(docs-infra): migrate aio from tslint to eslint (#42820)
migrate aio to eslint as tslint has been deprecated, the migration is restricted to the aio app and
its e2e tests and does not include the other tools, for such reason both tslint and codelyzer have not
been removed (to be done in a next PR)

some minor tweaks needed to be applied to the code so that it would adhere to the new ESLinting behaviour

most TSLint rules have been substituted with their ESLint equivalent, with some exceptions:
  * [whitespace] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [import-spacing] does not have an ESLint equivalent (suggested to be handled by prettier)
  * [ban] replaced with [no-restricted-syntax] as there is no (official/included) ESLint equivalent

some rules have minor different behaviours compared to their TSLint counterparts:
  * @typescript-eslint/naming-convention:
    - typescript-eslint does not enforce uppercase for const only.
  * @typescript-eslint/no-unused-expressions:
    - The TSLint optional config "allow-new" is the default ESLint behavior and will no longer be ignored.
  * arrow-body-style:
    - ESLint will throw an error if the function body is multiline yet has a one-line return on it.
  * eqeqeq:
    - Option "smart" allows for comparing two literal values, evaluating the value of typeof and null comparisons.
  * no-console:
    - Custom console methods, if they exist, will no longer be allowed.
  * no-invalid-this:
    - Functions in methods will no longer be ignored.
  * no-underscore-dangle:
    - Leading and trailing underscores (_) on identifiers will now be ignored.
  * prefer-arrow/prefer-arrow-functions:
    - ESLint does not support allowing standalone function declarations.
    - ESLint does not support allowing named functions defined with the function keyword.
  * space-before-function-paren:
    - Option "constructor" is not supported by ESLint.
    - Option "method" is not supported by ESLint.

additional notes:
  * the current typescript version used by the aio app is 4.3.5, which is not supported by typescript-eslint (the supported
    versions are >=3.3.1 and <4.3.0). this causes a warning message to appear during linting, this issue should
    likely/hopefully disappear in the future as typescript-eslint catches up
  * The new "no-console" rule is not completely equivalent to what we had prior the migration, this is because TSLint's "no-console"
    rule let you specify the methods you did not want to allow, whilst ESLint's "no-console" lets you specify the methods that you do
    want to allow, so and in order not to have a very long list of methods in the ESLint rule it's been decided for the time being
    to simply only allow the "log", "warn" and "error" methods
  * 4 dependencies have been added as they have been considered necessary (see: https://github.com/angular/angular/pull/42820#discussion_r669978232)

extra:
  * the migration has been performed by following: https://github.com/angular-eslint/angular-eslint#migrating-an-angular-cli-project-from-codelyzer-and-tslin
  * more on typescript-eslint at: https://github.com/typescript-eslint/typescript-eslint

PR Close #42820
2021-07-20 11:55:28 -07:00
George Kalpakas 722eb5dd45 fix(docs-infra): prevent main content from overlapping with ToC (#42884)
Previously, if there was more content than what would horizontally fit
in the main content area, it would overflow to the right and overlap
with the Table of Contents (ToC).
This was accidentally introduced in #42787.

This commit fixes it by ensuring that the main content area will not
overlap with ToC and the necessary space for the ToC will be reserved
using `margin` (instead of `padding`, which contributes to the element's
size).

Fixes #42867

PR Close #42884
2021-07-19 17:35:35 -07:00
George Kalpakas e7c770709b fix(docs-infra): correctly handle reported errors (#42883)
Error-handling in AIO happens mainly in two places:
1. For errors happening inside the app we have a custom `ErrorHandler`
   implementation, `ReportingErrorHandler`. `ReportingErrorHandler`
   passes errors to the default `ErrorHandler` (for them to be logged to
   the console) and also forwards them to `window.onerror()`.
2. Errors happening outside the app and errors forwarded by
   `ReportingErrorHandler` are handled by `window.onerror()`, which in
   turn reports them to Google analytics.

Previously, we were making some assumptions (which turned out to be
incorrect based on the info captured in Google analytics - see #28106):
- `ReportingErrorHandler` assumed that the errors passed to its
  `handleError()` method would be either strings or `Error` instances.
  _Apparently, other values (such as `null` or `undefined`) may also be
  passed._
- `window.onerror()` assumed that if an `Error` instance was passed in,
  it would always have a stacktrace (i.e. its `stack` property would be
  defined).
  _This is not necessarily true, although it is not clear (based on the
  logs) whether reported errors of this type are caused by `Error`
  instance with no stacktrace or by non-string error objects which are
  incorrectly treated as `Error` instances.

This commit ensures that all types of error arguments can be handled
correctly, including `Error` instances with no stacktrace and other
types of objects or primitives.

NOTE:
PR #42881 is related as it fixes handling `null` and `undefined`
arguments in the default `ErrorHandler`.

Fixes #28106

PR Close #42883
2021-07-19 17:35:02 -07:00