fix(aio): restore visible sidenav keyboard focus; shift TOC up
closes #17665
Restores keyboard focus that was removed by commit b8b91d3
.
Raises the right-TOC by 20px (96px->76px) because was too far down.
To prevent keyboard focus on hidden child nodes,
also collapses inner expanded nodes when parent node is collapsed.
The implicit parent node of top nodes is always expanded.
This commit is contained in:
parent
b052ef5f1e
commit
4459e0c1c8
|
@ -277,7 +277,7 @@ export class AppComponent implements OnInit {
|
||||||
this.tocMaxHeightOffset =
|
this.tocMaxHeightOffset =
|
||||||
el.querySelector('footer').clientHeight +
|
el.querySelector('footer').clientHeight +
|
||||||
el.querySelector('md-toolbar.app-toolbar').clientHeight +
|
el.querySelector('md-toolbar.app-toolbar').clientHeight +
|
||||||
44; // margin
|
24; // fudge margin
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tocMaxHeight = (document.body.scrollHeight - window.pageYOffset - this.tocMaxHeightOffset).toFixed(2);
|
this.tocMaxHeight = (document.body.scrollHeight - window.pageYOffset - this.tocMaxHeightOffset).toFixed(2);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
<div class="heading-children" [ngClass]="classes">
|
<div class="heading-children" [ngClass]="classes">
|
||||||
<aio-nav-item *ngFor="let node of nodeChildren" [level]="level + 1" [isWide]="isWide"
|
<aio-nav-item *ngFor="let node of nodeChildren" [level]="level + 1" [isWide]="isWide"
|
||||||
|
[isParentExpanded]="isExpanded"
|
||||||
[node]="node" [selectedNodes]="selectedNodes"></aio-nav-item>
|
[node]="node" [selectedNodes]="selectedNodes"></aio-nav-item>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,6 +9,7 @@ export class NavItemComponent implements OnChanges {
|
||||||
@Input() isWide = false;
|
@Input() isWide = false;
|
||||||
@Input() level = 1;
|
@Input() level = 1;
|
||||||
@Input() node: NavigationNode;
|
@Input() node: NavigationNode;
|
||||||
|
@Input() isParentExpanded = true;
|
||||||
@Input() selectedNodes: NavigationNode[];
|
@Input() selectedNodes: NavigationNode[];
|
||||||
|
|
||||||
isExpanded = false;
|
isExpanded = false;
|
||||||
|
@ -22,9 +23,10 @@ export class NavItemComponent implements OnChanges {
|
||||||
if (this.selectedNodes) {
|
if (this.selectedNodes) {
|
||||||
const ix = this.selectedNodes.indexOf(this.node);
|
const ix = this.selectedNodes.indexOf(this.node);
|
||||||
this.isSelected = ix !== -1; // this node is the selected node or its ancestor
|
this.isSelected = ix !== -1; // this node is the selected node or its ancestor
|
||||||
this.isExpanded = this.isSelected || // expand if selected or ...
|
this.isExpanded = this.isParentExpanded &&
|
||||||
|
(this.isSelected || // expand if selected or ...
|
||||||
// preserve expanded state when display is wide; collapse in mobile.
|
// preserve expanded state when display is wide; collapse in mobile.
|
||||||
(this.isWide && this.isExpanded);
|
(this.isWide && this.isExpanded));
|
||||||
} else {
|
} else {
|
||||||
this.isSelected = false;
|
this.isSelected = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ aio-nav-menu {
|
||||||
}
|
}
|
||||||
|
|
||||||
aio-nav-item div a {
|
aio-nav-item div a {
|
||||||
padding-left: 16px;
|
padding-left: 6px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,27 +67,26 @@ md-sidenav-container div.mat-sidenav-content {
|
||||||
overflow-wrap: break-word;
|
overflow-wrap: break-word;
|
||||||
padding-top: 4px;
|
padding-top: 4px;
|
||||||
padding-bottom: 4px;
|
padding-bottom: 4px;
|
||||||
padding-left: 16px;
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
transition-duration: 180ms;
|
width: 93%;
|
||||||
transition-property: background-color, color;
|
|
||||||
transition-timing-function: ease-in-out;
|
|
||||||
width: 100%;
|
|
||||||
word-wrap: break-word;
|
word-wrap: break-word;
|
||||||
outline: none;
|
|
||||||
transition: all 0.3s ease-in-out;
|
|
||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
text-shadow: 0 0 5px #ffffff;
|
background-color: $lightgray;
|
||||||
color: $blue;
|
color: $blue;
|
||||||
|
text-shadow: 0 0 5px #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:focus {
|
||||||
|
outline: $accentblue auto 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
//icons _within_ nav
|
//icons _within_ nav
|
||||||
.mat-icon {
|
.mat-icon {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 8px;
|
right: 0;
|
||||||
margin: 4px;
|
margin: 4px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,11 +98,10 @@ md-sidenav-container div.mat-sidenav-content {
|
||||||
button.vertical-menu-item {
|
button.vertical-menu-item {
|
||||||
border: none;
|
border: none;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
padding: 8px 0 8px 20px;
|
margin-right: 0;
|
||||||
|
padding-left: 6px;
|
||||||
&:focus {
|
padding-top: 8px;
|
||||||
color: $black;
|
padding-bottom: 10px;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading {
|
.heading {
|
||||||
|
@ -111,7 +109,6 @@ button.vertical-menu-item {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
position: relative;
|
position: relative;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
width: 100%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.heading-children.expanded {
|
.heading-children.expanded {
|
||||||
|
@ -136,25 +133,25 @@ button.vertical-menu-item {
|
||||||
font-family: $main-font;
|
font-family: $main-font;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding-left: 20px;
|
margin-left: 14px;
|
||||||
transition: background-color 0.2s;
|
transition: background-color 0.2s;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-2 {
|
.level-2 {
|
||||||
|
color: $mediumgray;
|
||||||
font-family: $main-font;
|
font-family: $main-font;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: $mediumgray;
|
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
padding-left: 20px;
|
margin-left: 12px;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-3 {
|
.level-3 {
|
||||||
|
color: $mediumgray;
|
||||||
font-family: $main-font;
|
font-family: $main-font;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: $mediumgray;
|
margin-left: 10px;
|
||||||
padding-left: 8px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.level-1.expanded .mat-icon, .level-2.expanded .mat-icon {
|
.level-1.expanded .mat-icon, .level-2.expanded .mat-icon {
|
||||||
|
@ -163,7 +160,7 @@ button.vertical-menu-item {
|
||||||
|
|
||||||
.level-1:not(.expanded) .mat-icon, .level-2:not(.expanded) .mat-icon {
|
.level-1:not(.expanded) .mat-icon, .level-2:not(.expanded) .mat-icon {
|
||||||
@include rotate(0deg);
|
@include rotate(0deg);
|
||||||
margin: 4px;
|
// margin: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.promo-img-container img {
|
.promo-img-container img {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
.toc-container {
|
.toc-container {
|
||||||
width: 18%;
|
width: 18%;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 96px;
|
top: 76px;
|
||||||
right: 0;
|
right: 0;
|
||||||
bottom: 32px;
|
bottom: 12px;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue