Skip to content

Commit 6bbc07c

Browse files
authoredFeb 2, 2021
fix(material-docs-app): remove absolute positioning of all content (#840)
- preserve behavior of not having a scrollbar next to the toolbar - hide theme picker on small devices (iPhone 5) so that navbar doesn't wrap
1 parent a860d71 commit 6bbc07c

File tree

8 files changed

+31
-22
lines changed

8 files changed

+31
-22
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
material-docs-app {
22
display: flex;
33
flex-direction: column;
4-
position: absolute;
5-
top: 56px;
6-
bottom: 0;
7-
left: 0;
8-
right: 0;
4+
height: 100vh;
95
}
106

117
app-navbar {
@@ -20,21 +16,16 @@ material-docs-app > app-component-sidenav {
2016
flex: 1;
2117
}
2218

23-
material-docs-app > app-homepage,
24-
material-docs-app > app-guides,
25-
material-docs-app > guide-viewer {
19+
material-docs-app > router-outlet + .main-content,
20+
material-docs-app > router-outlet + app-component-sidenav {
21+
margin-top: 56px;
2622
overflow-y: auto;
2723
-webkit-overflow-scrolling: touch;
2824
}
2925

3026
@media (max-width: 720px) {
31-
material-docs-app {
32-
top: 92px;
33-
}
34-
35-
material-docs-app > app-homepage,
36-
material-docs-app > app-guides,
37-
material-docs-app > guide-viewer {
38-
overflow-y: visible;
27+
material-docs-app > router-outlet + .main-content,
28+
material-docs-app > router-outlet + app-component-sidenav {
29+
margin-top: 92px;
3930
}
4031
}

‎material.angular.io/src/app/pages/guide-list/guide-list.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, NgModule, OnInit} from '@angular/core';
1+
import {Component, HostBinding, NgModule, OnInit} from '@angular/core';
22
import {GuideItems} from '../../shared/guide-items/guide-items';
33
import {MatListModule} from '@angular/material/list';
44
import {RouterModule, Routes} from '@angular/router';
@@ -14,6 +14,8 @@ import {MatCardModule} from '@angular/material/card';
1414
styleUrls: ['./guide-list.scss']
1515
})
1616
export class GuideList implements OnInit {
17+
@HostBinding('class.main-content') readonly mainContentClass = true;
18+
1719
constructor(public guideItems: GuideItems, public _componentPageTitle: ComponentPageTitle) {}
1820

1921
ngOnInit(): void {

‎material.angular.io/src/app/pages/guide-viewer/guide-viewer.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, NgModule, OnInit} from '@angular/core';
1+
import {Component, HostBinding, NgModule, OnInit} from '@angular/core';
22
import {ActivatedRoute, Router, RouterModule, Routes} from '@angular/router';
33
import {GuideItem, GuideItems} from '../../shared/guide-items/guide-items';
44
import {FooterModule} from '../../shared/footer/footer';
@@ -14,6 +14,7 @@ import {NavigationFocusModule} from '../../shared/navigation-focus/navigation-fo
1414
styleUrls: ['./guide-viewer.scss'],
1515
})
1616
export class GuideViewer implements OnInit {
17+
@HostBinding('class.main-content') readonly mainContentClass = true;
1718
guide: GuideItem | undefined;
1819

1920
constructor(_route: ActivatedRoute,

‎material.angular.io/src/app/pages/homepage/homepage.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, NgModule, OnInit} from '@angular/core';
1+
import {Component, HostBinding, NgModule, OnInit} from '@angular/core';
22
import {SvgViewerModule} from '../../shared/svg-viewer/svg-viewer';
33
import {MatButtonModule} from '@angular/material/button';
44
import {FooterModule} from '../../shared/footer/footer';
@@ -20,6 +20,7 @@ const TOP_COMPONENTS = ['datepicker', 'input', 'slide-toggle', 'slider', 'button
2020
styleUrls: ['./homepage.scss']
2121
})
2222
export class Homepage implements OnInit {
23+
@HostBinding('class.main-content') readonly mainContentClass = true;
2324
isNextVersion = location.hostname.startsWith('next.material.angular.io');
2425

2526
constructor(public _componentPageTitle: ComponentPageTitle, public guideItems: GuideItems) {

‎material.angular.io/src/app/pages/not-found/not-found.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, NgModule} from '@angular/core';
1+
import {Component, HostBinding, NgModule} from '@angular/core';
22
import {MatButtonModule} from '@angular/material/button';
33
import {FooterModule} from '../../shared/footer/footer';
44
import {RouterModule, Routes} from '@angular/router';
@@ -9,6 +9,7 @@ import {RouterModule, Routes} from '@angular/router';
99
styleUrls: ['./not-found.scss']
1010
})
1111
export class NotFound {
12+
@HostBinding('class.main-content') readonly mainContentClass = true;
1213
}
1314

1415
const routes: Routes = [{path: '', component: NotFound}];

‎material.angular.io/src/app/shared/navbar/navbar.scss

+8
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,11 @@
6969
margin: 0;
7070
}
7171
}
72+
73+
theme-picker {
74+
display: none;
75+
76+
@media (min-width: 328px) {
77+
display: block;
78+
}
79+
}

‎material.angular.io/src/styles/_general.scss

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
html,
2+
body {
3+
height: 100vh;
4+
}
5+
16
body {
27
font-family: "Roboto","Helvetica Neue Light","Helvetica Neue",Helvetica,Arial,"Lucida Grande",sans-serif;
38
margin: 0;

‎material.angular.io/tools/audit-docs-a11y.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ const MIN_SCORES_PER_PAGE = {
2828
'components/categories' : 91,
2929
'cdk/categories' : 91,
3030
'guides' : 100,
31-
'guide/creating-a-custom-form-field-control' : 99,
32-
'guide/getting-started' : 98,
31+
'guide/creating-a-custom-form-field-control' : 97,
32+
'guide/getting-started' : 96,
3333
'cdk/a11y/overview' : 85,
3434
'cdk/a11y/api' : 89,
3535
'cdk/a11y/examples' : 85,

0 commit comments

Comments
 (0)
Please sign in to comment.