fix(docs-infra): prevent search-bar from overlapping nav-items by gkalpak · Pull Request #37938 · angular/angular · GitHub
Skip to content

fix(docs-infra): prevent search-bar from overlapping nav-items - #37938

Closed
gkalpak wants to merge 4 commits into
angular:masterfrom
gkalpak:fix-aio-hidden-navitem
Closed

gkalpak wants to merge 4 commits into
angular:masterfrom
gkalpak:fix-aio-hidden-navitem

Conversation

@gkalpak

@gkalpak gkalpak commented Jul 6, 2020

Copy link
Copy Markdown
Member

As part of angular.io's responsive layout, the menu shown in the top-bar is collapsed into the sidenav on narrow screens at the point where the search-bar (on the right side of the top-bar) would overlap with the menu's nav-items.

Previously, the value used as break-point would work on marketing pages, where the hamburger button is not shown on wide screens. However, on docs pages (where the hamburger button is always shown, pushing the menu further to the right), the search-bar would still overlap the menu nav-items on some resolutions.

This commit fixes it by raising the screen width threshold at a value that ensures there is no overlap even on pages where the hamburger button is visible alongside the top-bar menu.

Fixes #37667.

This PR also includes some refactorings in preparation of the fix. See individual commits for details.

@gkalpak gkalpak added comp: docs-infra action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release type: bug/fix labels Jul 6, 2020
@ngbot ngbot Bot modified the milestone: needsTriage Jul 6, 2020
@gkalpak
gkalpak requested a review from petebacondarwin July 6, 2020 13:04
@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.

A few minor suggestions... I never liked that side-by-side thing so thanks for getting rid of that.

Comment thread aio/src/app/app.component.spec.ts Outdated

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.

Suggested change
describe('when side-by-side (wide)', () => {
describe('when view is wide', () => {

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.

there is probably an equivalent narrow describe block in this file too.

Comment thread aio/src/app/app.component.spec.ts Outdated

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.

Suggested change
beforeEach(() => resizeTo(dockSideNavWidth + 1)); // side-by-side
beforeEach(() => resizeTo(dockSideNavWidth + 1)); // wide view

Comment thread aio/src/app/app.component.spec.ts Outdated

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.

Suggested change
describe('when NOT side-by-side (narrow)', () => {
describe('when view is narrow', () => {

Comment thread aio/src/app/app.component.spec.ts Outdated

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.

Suggested change
beforeEach(() => resizeTo(dockSideNavWidth - 1)); // NOT side-by-side
beforeEach(() => resizeTo(dockSideNavWidth - 1)); // narrow view

Comment thread aio/src/app/app.component.spec.ts Outdated

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.

This describe block could be:

describe('when changing from narrow to wide view', () => {

Comment thread aio/src/styles/1-layouts/_top-menu.scss Outdated

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.

Ideally this should have the same name (or as close as possible to the constant in app.component.ts (showTopMenuWidth) and I would argue that it would be better for the previous line to be computed from this line, rather than the other way around so that the same constant value (i.e. 1048) is used in both.

The reasoning is that there is no clear indication that these need to be kept in sync. One could imagine searching for the equivalent name or value and not finding anything.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point 👍

gkalpak added 2 commits July 6, 2020 19:10
…show/hide threshold

Use a Sass variable for the screen width break-point at which the
top-bar hamburger button is hidden/shown. This allows more easily
updating the break-point.
…howing the sidenav

As part of angular.io's responsive layout, the following rules are
applied:
- On wide screens, a menu is shown in the top-bar and the sidenav is
  shown side-by-side with the docs content.
- On narrow screens, the top-menu is moved from the top-bar to the
  sidenav and the sidenav is closed by default and floats over the
  content when manually opened.

Previously, the break-points at which the top-menu was shown in the
top-bar and the sidenav was shown side-by-side with the content were the
same (using a single variable).

This commit decouples the two break-points to make it possible to use
different values in the future.
@petebacondarwin petebacondarwin added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Jul 6, 2020
gkalpak added 2 commits July 6, 2020 19:47
As part of angular.io's responsive layout, the menu shown in the top-bar
is collapsed into the sidenav on narrow screens at the point where the
search-bar (on the right side of the top-bar) would overlap with the
menu's nav-items.

Previously, the value used as break-point would work on marketing pages,
where the hamburger button is not shown on wide screens. However, on
docs pages (where the hamburger button is always shown, pushing the menu
further to the right), the search-bar would still overlap the menu
nav-items on some resolutions.

This commit fixes it by raising the screen width threshold at a value
that ensures there is no overlap even on pages where the hamburger
button is visible alongside the top-bar menu.

Fixes angular#37937
@gkalpak gkalpak removed the action: merge The PR is ready for merge by the caretaker label Jul 6, 2020
@gkalpak
gkalpak force-pushed the fix-aio-hidden-navitem branch from bfe4764 to 2112df4 Compare July 6, 2020 16:50
@mary-poppins

Copy link
Copy Markdown

You can preview 2112df4 at https://pr37938-2112df4.ngbuilds.io/.

@gkalpak gkalpak added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Jul 6, 2020
alxhub pushed a commit that referenced this pull request Jul 6, 2020
…show/hide threshold (#37938)

Use a Sass variable for the screen width break-point at which the
top-bar hamburger button is hidden/shown. This allows more easily
updating the break-point.

PR Close #37938
alxhub pushed a commit that referenced this pull request Jul 6, 2020
…howing the sidenav (#37938)

As part of angular.io's responsive layout, the following rules are
applied:
- On wide screens, a menu is shown in the top-bar and the sidenav is
  shown side-by-side with the docs content.
- On narrow screens, the top-menu is moved from the top-bar to the
  sidenav and the sidenav is closed by default and floats over the
  content when manually opened.

Previously, the break-points at which the top-menu was shown in the
top-bar and the sidenav was shown side-by-side with the content were the
same (using a single variable).

This commit decouples the two break-points to make it possible to use
different values in the future.

PR Close #37938
alxhub pushed a commit that referenced this pull request Jul 6, 2020
As part of angular.io's responsive layout, the menu shown in the top-bar
is collapsed into the sidenav on narrow screens at the point where the
search-bar (on the right side of the top-bar) would overlap with the
menu's nav-items.

Previously, the value used as break-point would work on marketing pages,
where the hamburger button is not shown on wide screens. However, on
docs pages (where the hamburger button is always shown, pushing the menu
further to the right), the search-bar would still overlap the menu
nav-items on some resolutions.

This commit fixes it by raising the screen width threshold at a value
that ensures there is no overlap even on pages where the hamburger
button is visible alongside the top-bar menu.

Fixes #37937

PR Close #37938
@alxhub alxhub closed this in 90b93da Jul 6, 2020
alxhub pushed a commit that referenced this pull request Jul 6, 2020
…howing the sidenav (#37938)

As part of angular.io's responsive layout, the following rules are
applied:
- On wide screens, a menu is shown in the top-bar and the sidenav is
  shown side-by-side with the docs content.
- On narrow screens, the top-menu is moved from the top-bar to the
  sidenav and the sidenav is closed by default and floats over the
  content when manually opened.

Previously, the break-points at which the top-menu was shown in the
top-bar and the sidenav was shown side-by-side with the content were the
same (using a single variable).

This commit decouples the two break-points to make it possible to use
different values in the future.

PR Close #37938
alxhub pushed a commit that referenced this pull request Jul 6, 2020
As part of angular.io's responsive layout, the menu shown in the top-bar
is collapsed into the sidenav on narrow screens at the point where the
search-bar (on the right side of the top-bar) would overlap with the
menu's nav-items.

Previously, the value used as break-point would work on marketing pages,
where the hamburger button is not shown on wide screens. However, on
docs pages (where the hamburger button is always shown, pushing the menu
further to the right), the search-bar would still overlap the menu
nav-items on some resolutions.

This commit fixes it by raising the screen width threshold at a value
that ensures there is no overlap even on pages where the hamburger
button is visible alongside the top-bar menu.

Fixes #37937

PR Close #37938
@gkalpak
gkalpak deleted the fix-aio-hidden-navitem branch July 7, 2020 09:48
@angular-automatic-lock-bot

Copy link
Copy Markdown

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Aug 7, 2020
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
…show/hide threshold (angular#37938)

Use a Sass variable for the screen width break-point at which the
top-bar hamburger button is hidden/shown. This allows more easily
updating the break-point.

PR Close angular#37938
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
…howing the sidenav (angular#37938)

As part of angular.io's responsive layout, the following rules are
applied:
- On wide screens, a menu is shown in the top-bar and the sidenav is
  shown side-by-side with the docs content.
- On narrow screens, the top-menu is moved from the top-bar to the
  sidenav and the sidenav is closed by default and floats over the
  content when manually opened.

Previously, the break-points at which the top-menu was shown in the
top-bar and the sidenav was shown side-by-side with the content were the
same (using a single variable).

This commit decouples the two break-points to make it possible to use
different values in the future.

PR Close angular#37938
profanis pushed a commit to profanis/angular that referenced this pull request Sep 5, 2020
…ar#37938)

As part of angular.io's responsive layout, the menu shown in the top-bar
is collapsed into the sidenav on narrow screens at the point where the
search-bar (on the right side of the top-bar) would overlap with the
menu's nav-items.

Previously, the value used as break-point would work on marketing pages,
where the hamburger button is not shown on wide screens. However, on
docs pages (where the hamburger button is always shown, pushing the menu
further to the right), the search-bar would still overlap the menu
nav-items on some resolutions.

This commit fixes it by raising the screen width threshold at a value
that ensures there is no overlap even on pages where the hamburger
button is visible alongside the top-bar menu.

Fixes angular#37937

PR Close angular#37938
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 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.

> [angular/aio/src/polyfills.ts](https://github.com/angular/angular/blob/0822dc70f2580a3d0e5c936ef07707dd09e7a878/aio/src/polyfills.ts#L38)

4 participants