Accessibility: Problem auto focusing on AG-Grid (inside Router-Outlet/Child Component) when navigating from App Component Menu Button - accessibility

I have used several methods.
OnCellClicked in Ag-Grid has the functions:
var firstCol = params.columnApi.getAllDisplayedColumns()[0];
params.api.ensureColumnVisible(firstCol);
Also tried referencing the AG-Grid with a ViewComponent Tag with its ID
<ag-grid-angular #agGrid
style="height: 740px; width: 100%;"
class="ag-theme-balham"
multiSortKey="ctrl"
rowSelection="single"
rowModelType="serverSide"
[modules]="modules"
[columnDefs]="columnDefs"
[defaultColDef]="defaultColDef"
[rowData]="rowDataServerSide"
[animateRows]="true"
[getRowHeight]="getRowHeight"
[ensureDomOrder]="true"
[suppressColumnVirtualisation]="true"
[pagination]="true"
(modelUpdated)="onModelUpdated($event)"
[paginationPageSize]="paginationPageSize"
(firstDataRendered)="onFirstDataRendered($event)"
[enableCellChangeFlash]="true"
(gridReady)="onGridReady($event)"
(cellClicked)="onCellClicked($event)"
(cellKeyPress)="onCellKeyPress($event)"
[enableBrowserTooltips]="true"
[statusBar]="statusBar"
[frameworkComponents]="frameworkComponents"
(cellFocused)="onCellFocused($event)"
(cellKeyDown)="onCellKeyDown($event)"
[tabToNextCell]="onTabToNextCell"
[navigateToNextCell]="onNavigateToNextCell">
</ag-grid-angular>
#ViewChildren('agGrid')
public agGrid: any;
this.agGrid.first._nativeElement.focus();
Have also tried disabling [autofocus] on the button via html properties.
This does not work either. I read in an article that when you navigate from a menu button, it auto focuses the menu option button. How do I get Angular to focus on the agGrid which is located inside the router-outlet after clicking a menu button and navigating to the ag-grid component?
<mat-sidenav-container *ngIf="!centurionPreview" class="sidenav-container">
<mat-sidenav #drawer class="sideNav" fixedInViewport *ngIf="(isHandset$ | async)"
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'" [mode]="(isHandset$ | async) ? 'over' : 'side'"
[opened]="(isHandset$ | async) === false"
(click)="toggleSidenav()">
<mat-toolbar>Menu</mat-toolbar>
<mat-nav-list #sideMenu class="side_menu">
<button
[disabled]="!navPerms.Library.functional"
[hidden]="!navPerms.Library.enabled"
[matMenuTriggerFor]="library"
mat-button>Library</button>
<mat-menu #library="matMenu">
<button *ngFor="let item of navPerms.Library.children"
[attr.aria-label]="getName(item.id) + 'Button'"
[hidden]="!item.functional || !item.enabled"
[disabled]="!item.functional || !item.enabled"
(click)="goToEntityPage(item.id)"
mat-menu-item>{{getName(item.id)}}
</button>
</mat-menu>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<mat-toolbar>
<button type="button" (click)="toggleSidenav()"
*ngIf="currentUser && (isHandset$ | async)">
<mat-icon aria-label="Side Navigation Toggle Icon">Menu</mat-icon>
</button>
<div *ngIf="currentUser && !(isHandset$ | async)">
<button
[disabled]="!navPerms.Library.functional"
[hidden]="!navPerms.Library.enabled"
[matMenuTriggerFor]="libraryMenu"
mat-button>Library</button>
<mat-menu #libraryMenu="matMenu">
<button *ngFor="let item of navPerms.Library.children"
[attr.aria-label]="getName(item.id) + 'Button'"
[hidden]="!item.functional || !item.enabled"
[disabled]="!item.functional || !item.enabled"
(click)="goToEntityPage(item.id)"
mat-menu-item>{{getName(item.id)}}
</button>
</mat-menu>
</mat-toolbar>
</mat-sidenav-content>
</mat-sidenav-container>
<!-- Add Content Here -->
<div #mainContent style="height:88%;width:100%;">
<router-outlet></router-outlet>
</div>

Related

Make v-expansion-panel relative

I have a v-expansion-panel and a sticky footer. What I'd like is for the footer to always be visible whether the panel is open or not. But at the moment, when the panel opens, it hides the footer even though the footer has the property > position : fixed.
It's going in front of all the elements in the page except the v-expansion-panel (only when it's open). Does anyone know if there's a property than can make the v-expansion-panel relative, so that it doesn't hide the footer ?
<v-expansion-panel
class="expPanel"
dense
v-if="
this.filteredNews[0].topic &&
this.filteredNews[0].topic.length != 0
"
>
<v-expansion-panel-header
color="#212121"
class="expPanelHeader"
>
TOPIC ( {{ this.filteredNews[0].topic.length }} )
</v-expansion-panel-header>
<v-expansion-panel-content
color="#212121"
class="expPanelHeader"
>
<v-list>
<v-list-item-group>
<div class="chip-expanel">
<v-chip
class="chip-node-data"
v-for="(item, index) in this.filteredNews[0].topic"
:key="index"
>
{ item }}
</v-chip>
</div>
</v-list-item-group>
</v-list>
</v-expansion-panel-content>
</v-expansion-panel>
<div class="divBottom1">
<v-list-item :ripple="false" inactive>
<v-spacer></v-spacer>
<div>
<a
target="_blank"
v-if="
this.filteredNews &&
this.filteredNews.length == '1' &&
this.filteredNews[0].file != ''
"
class="links"
:href="this.filteredNews[0].file"
>
<button class="access-this-news">
<v-icon :color="backgroundDark3">mdi-arrow-right</v-icon>
<span>Access this news</span>
</button>
</a>
</div>
</v-list-item>
</div>
The divBottom1 is just the footer. It has a position: fixed, width: 100% and bottom: 0. Does anyone know how to make it dominating ?

The first menu is not showing in mat-toolbar if its sub menu is empty by using angular material

I want to create a nested menus. The top menu bar has 4 elements.
DevFestFL
Disney
Orlando
Maleficent
The first one doesn't have child menu and the rest of them have children. Now the issue is the first menu is not showing or its color is eaten by the background color. I think that I may need to change the code but not sure.
<mat-menu #childMenu="matMenu" [overlapTrigger]="false">
<span *ngFor="let child of items">
<!-- Handle branch node menu items -->
<span *ngIf="child.children && child.children.length > 0">
<button mat-menu-item color="primary" [matMenuTriggerFor]="menu.childMenu">
<mat-icon>{{child.iconName}}</mat-icon>
<span>{{child.label}}</span>
</button>
<app-menu-item #menu [items]="child.children"></app-menu-item>
</span>
<!-- Handle leaf node menu items -->
<span *ngIf="!child.children || child.children.length === 0">
<button mat-menu-item [routerLink]="child.route">
<mat-icon>{{child.iconName}}</mat-icon>
<span>{{child.label}}</span>
</button>
</span>
</span>
</mat-menu>
StackBlitz Demo
Add below style in app.component.scss, It will fix the issue.
.menu-bar .mat-button.mat-primary {
color: white;
}
Check the modified working code.
https://stackblitz.com/edit/dynamic-nested-topnav-menu-j4hu3k?file=app/app.component.scss

How to dynamically set the width of main content based on weather side nav is opened or closed in material Angular

I am new to angular and material framework. I am trying to create a page which has below structure
The button on right side of Admin portal works perfectly fine and it hides and shows the side menu.
Most of the code is default code generated by angular.
In order to shift the left menu below top navbar i used [fixedTopGap]="64" on mat-sidenav.
To expand the top menu to take full width i used class main top bar in below line:-
<mat-sidenav-content class="mainTopBar">
Css for main topBar:-
.mainTopBar
{
margin-left:0px !important;
}
Doing so gave me full top menu, but now the problem is whatever content i am trying to place using ng content gets stuck to the very left.
How can i provide margin to ng content based on if left menu is opened or not.
Here is my html code :-
<mat-sidenav-container class="sidenav-container">
<mat-sidenav #drawer class="sidenav" fixedInViewport="true"
[attr.role]="(isHandset$ | async) ? 'dialog' : 'navigation'"
[mode]="(isHandset$ | async) ? 'over' : 'side'"
[opened]="!(isHandset$ | async)" [fixedTopGap]="64">
<mat-toolbar class="Namebar">Menu</mat-toolbar>
<mat-nav-list >
<a mat-list-item href="#">Link 1</a>
<a mat-list-item href="#">Link 2</a>
<a mat-list-item href="#">Link 3</a>
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content class="mainTopBar">
<mat-toolbar color="primary">
<button
type="button"
aria-label="Toggle sidenav"
mat-icon-button
(click)="drawer.toggle()"
*ngIf="isHandset$ | async">
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
<span>Admin Portal</span>
<button
type="button"
style="position:absolute;margin-left:200px;"
aria-label="Toggle sidenav"
mat-icon-button
*ngIf="!(isHandset$ | async)"
(click)="drawer.toggle()"
>
<mat-icon aria-label="Side nav toggle icon">menu</mat-icon>
</button>
</mat-toolbar>
<ng-content style="margin-left: 200px !important; "></ng-content>
</mat-sidenav-content>
</mat-sidenav-container>
I tried using margin-left:200px but that even that didn't work.
On Side bar open it shoul look like:-
Based on Yin answer, the screen which i am getting is :-
Finally i found the issue.
I made top nav bar(mat-toolbar) as fixed and width to 100vw.
Added autosize here <mat-sidenav-container class="sidenav-container" autosize >
And it started working as expected
Don't use margin-left, just add autosize on the mat-sidenav-container :
<mat-sidenav-container class="sidenav-container" autosize >...

How to use p-tiered menu in mat-sidenav content with router-outlet?

we have used p-tiered menu to display submenus in mat-sidenav and we have placed inside
p-tiered menu not displaying correctly in mat-sidenav as shown in below screenshot:
Here is the screenshot:
It should display submenu (PQR, LMN) outside the context of mat-sidenav i.e. inside router outlet
<mat-sidenav-container>
<mat-sidenav #projectnav
mode="side"
opened>
<mat-nav-list>
<div *ngFor="let menuItem of menuArray" >
{{ menuItem.visible }}
<app-tiered-menu *ngIf="menuOpen" [menuItems]="[menuItem]">
</app-tiered-menu>
</div>
</mat-nav-list>
</mat-sidenav>
<mat-card-content>
<router-outlet></router-outlet>
</mat-card-content>
</mat-sidenav-container>

Make Semantic UI menu collapse and responsive

I have looked everywhere on the docs, and nothing. Im looking for a similar navbar collapse function that's used in bootstrap with the hamburger(I can click on) to side and menu items inside of it. Please help.
Semantic UI looks good but can be a pain to use
This is a pretty good (and simple) implementation (credit: https://codepen.io/designosis/pen/LbMgya)
HTML
<div class="ui grid">
<div class="computer only row">
<div class="column">
<div class="ui menu">
<a class="item">Menu Item A</a>
<a class="item">Menu Item B</a>
<a class="item">Menu Item C</a>
<a class="item">Menu Item D</a>
</div>
</div>
</div>
<div class="tablet mobile only row">
<div class="column">
<div class="ui menu">
<a id="mobile_item" class="item"><i class="bars icon"></i></a>
</div>
</div>
</div>
</div>
<div class="ui pushable segment">
<div class="ui sidebar vertical menu">
<a class="item">Menu Item A</a>
<a class="item">Menu Item B</a>
<a class="item">Menu Item C</a>
<a class="item">Menu Item D</a>
</div>
<div class="pusher">
<div id="content" class="ui segment">
Content here
</div>
</div>
</div>
CSS
#content {
min-height: 100px;
}
.ui.grid{
padding: 0 !important;
}
.pushable.segment{
margin: 0 !important;
}
JavaScript
$('.ui.sidebar').sidebar({
context: $('.ui.pushable.segment'),
transition: 'overlay'
}).sidebar('attach events', '#mobile_item');
Here is a collapsable NavMenu component I've made using the Responsive component available in Semantic-UI-React:
import React, { useState } from 'react';
import { Menu, Responsive, Dropdown, DropdownMenu } from 'semantic-ui-react';
import { withRouter } from 'react-router-dom';
import LogoutModal from './LogoutModal';
function NavMenu(props) {
const [activeItem, setActiveItem] = useState('Laptop Item')
const [showModal, setShowModal] = useState(false)
return (
<div>
<Menu pointing secondary>
<Responsive as={Menu.Item} minWidth={790}
name='Laptop Item'
active={activeItem === 'Laptop Item'}
onClick={() => setActiveItem('Test Item')}
/>
<Responsive as={Menu.Item} minWidth={790}
name='Laptop Item 2'
active={activeItem === 'Laptop Item 2'}
onClick={() => setActiveItem('Test Item 2')}
/>
<Responsive as={Menu.Item} minWidth={790}
name='Laptop Item 3'
active={activeItem === 'Laptop Item 3'}
onClick={() => setActiveItem('Test Item 3')}
/>
<Menu.Menu position = 'right'>
<Responsive as ={Menu.Item} minWidth={790}
name = "Sign Out"
onClick={() => setShowModal(true)}
/>
</Menu.Menu>
<Responsive as ={Menu.Menu} maxWidth={789} position='right'>
<Dropdown
item
icon ='bars'
>
<Dropdown.Menu>
<Dropdown.Item text='Mobile/Tablet Item 1'/>
<Dropdown.Item text='Mobile/Tablet Item 2'/>
<Dropdown.Item text='Mobile/Tablet Item 3'/>
<Dropdown.Item text='Sign Out'/>
</Dropdown.Menu>
</Dropdown>
</Responsive>
</Menu>
</div>
)
}
export default withRouter(NavMenu);
I'm going for a traditional looking navigation bar with links on the left side and a Logout button on the right side. Although the width in pixels of an iPad (as shown in Chrome dev tools) is 768px, for some reason the breakpoint is 790px for me (appreciate if someone can tell me why this is). That is why min width for 'Laptop Items' is 790 and maxWidth for 'Mobile/Tablet Items' is 789.
I did not find the responsive component in the Semantic-UI docs. It is listed under "Addons" in Semantic-UI-React.
If you're not using React an alternative is to implement the side bar for mobile users.
if you are counting towards the semantics the most correct is you use the tags list as navbar and hide it or not with javascript.
Really html semantics is very bad, very complex code to do something simple

Resources