md-no-focus-style does not work properly in my setup - html

I have a button to open my navbar:
And after I click it it get's some kind of hitmarker:
After clicking on some navbar item (thus switching to next state/view) the hitmarker should disappear. Unforunately the hitmarker is present till I click on a random element.
The html for the button:
<div ng-controller="navbarCtrl" ng-cloak>
<md-content>
<md-toolbar>
<div class="md-toolbar-tools">
<md-button class="md-icon-button" ng-click="toggleMenu()" aria-label="Menu">
<md-icon md-svg-icon="assets/img/menu.svg"></md-icon>
</md-button>
<h2>
<span><a ui-sref="overview">Test</a></span>
</h2>
<span flex></span>
<md-button class="md-icon-button" ui-sref="account" aria-label="Account">
<md-icon md-svg-icon="assets/img/account.svg"></md-icon>
</md-button>
</div>
</md-toolbar>
</md-content>
<section layout="row" flex>
<md-sidenav class="md-sidenav-left md-whiteframe-z2" md-component-id="left">
<md-toolbar class="md-theme-indigo" layout="row">
<h1 class="md-toolbar-tools">Menu</h1>
<span flex></span>
<md-button class="md-icon-button" aria-label="close" ng-click="close()">
<md-icon md-svg-icon="assets/img/closeNavbar.svg"></md-icon>
</md-button>
</md-toolbar>
<div layout="column" layout-align=" center">
<md-button ui-sref-active="active" ng-click="close()" layout-align=" center" style="text-align:left" ui-sref="overview">Overview</md-button>
</div>
</md-sidenav>
</section>
</div>
<div ui-view></div>
What do I have to change in order to fix this?

You need this in your CSS:
.md-focused {
background: transparent !important;
}

add this to your CSS:
md-button:focus, md-icon:focus {
outline: none;
}

Related

How to vertically fill the screen with a div while using only material 2 classes and without using css?

I am using angular 4 with its respective Material . My app.component.html looks like this :
<!--The whole content below can be removed with the new code.-->
<md-toolbar color="primary" >
<button md-button (click)="sidenav.toggle()"><md-icon class="md-18|md-
24|md-36|md-48">menu</md-icon></button>
<span>Material 2</span>
<span class="example-spacer"></span>
</md-toolbar>
<md-sidenav-container layout="column" flex style="background: plum;">
<md-sidenav #sidenav side="left" class="example-sidenav" flex layout="column" style="background: plum;">
<md-list>
<div class="row">
<md-list-item><md-icon>explore</md-icon> <span>item</span></md-list-item>
</div>
<div class="row">
<md-list-item><md-icon>map</md-icon> <span>item</span></md-list-item>
</div>
<div class="row">
<md-list-item><md-icon>home</md-icon> <span>item</span></md-list-item>
</div>
<div class="row">
<md-list-item><md-icon>android</md-icon> <span>item</span></md-list-item>
</div>
<div class="row">
<md-list-item><md-icon>done</md-icon> <span>item</span></md-list-item>
</div>
</md-list>
</md-sidenav>
<md-grid-list cols="4" rowHeight="100px" layout="column" flex>
</md-grid-list>
</md-sidenav-container>
`
How to make the md-sidenav-container take up all of the space left vertically?
Plunkr : https://plnkr.co/edit/Mvm6zSifW0EpeKtmuSEA?p=preview
Note: I don't want a CSS min-height, height: 100% fix. Only a clean class/directive based solution for Angular Material 2/4.
Move your <md-toolbar> inside the container and add the fullscreen attribute to the <md-sidenav-container>:
<md-sidenav-container layout="column" flex style="background: plum;" fullscreen>
<md-toolbar color="primary" >
<button md-button (click)="sidenav.toggle()"><md-icon class="md-18|md-24|md-36|md-48">menu</md-icon></button>
<span>Hems IRCA</span>
<span class="example-spacer"></span>
</md-toolbar>
...
See this answer for more details
Updated plunker

Angular2 Material Design Toolbar

I'm trying to design a toolbar in Material and Angular2 as shown in the image below. I'm unable to format the toolbar such that the search bar comes in the center (and is in white) and the Create Project and remaining other buttons are flush to the right. The code for this is as follows:
<md-sidenav-container fullscreen>
<md-sidenav mode="side" opened="false" #sidenav>
<md-toolbar color="primary">AppLogo</md-toolbar>
</md-sidenav>
<div class="main-content">
<md-toolbar color="primary">
<span><button md-button (click)="sidenav.toggle()"><md-icon>menu</md-icon></button></span>
<span><h2>Application Name</h2></span>
<md-input-container>
<input mdInput placeholder="Search">
</md-input-container>
<div id="right_nav">
<span><button md-button><md-icon>add</md-icon> Create Project</button></span>
<span><button md-button><md-icon>help</md-icon></button></span>
<span><button md-button><md-icon>alarm</md-icon></button></span>
<span><button md-button><md-icon>face</md-icon></button></span>
</div>
</md-toolbar>
</div>
</md-sidenav-container>
How do I go about doing this using the available Material constructs?
Split toolbar content in 3 part then align each part as needed, flex let content cover 100% width.
<md-sidenav-container fullscreen>
<md-sidenav mode="side" opened="false" #sidenav>
<md-toolbar color="primary">AppLogo</md-toolbar>
</md-sidenav>
<div class="main-content">
<md-toolbar color="primary" layout="row">
<div flex layout="row" layout-align="start center">
<span><button md-button (click)="sidenav.toggle()"><md-icon>menu</md-icon></button></span>
<span><h2>Application Name</h2></span>
</div>
<div flex layout="row" layout-align="center center">
<md-input-container>
<input mdInput placeholder="Search">
</md-input-container>
</div>
<div id="right_nav" flex layout="row" layout-align="end center">
<span><button md-button><md-icon>add</md-icon> Create Project</button></span>
<span><button md-button><md-icon>help</md-icon></button></span>
<span><button md-button><md-icon>alarm</md-icon></button></span>
<span><button md-button><md-icon>face</md-icon></button></span>
</div>
</md-toolbar>
</div>
</md-sidenav-container>
EXAMPLE

Position fixed css adding in body tag in angular material

I'm facing some issues with position: fixed; width: 100%; top: 0px; for md-select md-autocomplete if I use them in some fixed. I face this issue with angular material for almost all the md-select options.
It's adding up the CSS attributes dynamically to the body section.
position: fixed; width: 100%; top: 0px; and scrollY.
index.html
<header class="container-fluid" id='headerControl' ng-cloak ng-controller = 'headerControl as ctrl'>
<div layout="row">
<div class="col-md-2 col-sm-2 logo">
<a href="/">
<img src="img/scooby.svg" alt="Logo" width="120px" class="img-responsive"></a>
</div>
<div class="col-md-7 col-sm-6 search-head hidden-xs">
<md-autocomplete
md-no-cache="ctrl.noCache"
md-selected-item="ctrl.selectedItem"
md-search-text-change="ctrl.searchTextChange(ctrl.searchText)"
md-search-text="ctrl.searchText"
md-selected-item-change="ctrl.selectedItemChange(item)"
md-items="item in ctrl.querySearch(ctrl.searchText)"
md-item-text="item.name"
md-min-length="0"
placeholder="Search....."
md-menu-class="autocomplete-custom-template">
<md-item-template>
<span class="item-title">
<span> {{item.name}} </span>
</span>
<span class="item-metadata">
<span class="item-metastat pull-right">
<strong>{{item.forks}}</strong>
</span>
</span>
</md-item-template>
</md-autocomplete>
<md-input-container class="md-block" md-no-float flex-gt-sm>
<md-icon md-svg-src="img/locationpin.svg"></md-icon>
<!-- <label>Location</label> -->
<md-select ng-model="user.state" placeholder="Location">
<md-option ng-repeat="state in states" value="{{state.abbrev}}">
{{state.abbrev}}
</md-option>
</md-select>
</md-input-container>
<button type="button" class="search-bt">GO</button>
</div>
<div class="col-md-3 col-sm-4 col-xs-10 head-link">
<p class="visible-xs mobile-menu-ic">
<md-menu md-offset="0 -5" ng-controller="menuCtrl as ctrl">
<md-button aria-label="Open demo menu" class="md-icon-button" ng-click="ctrl.openMenu($mdOpenMenu, $event)">
<i class="material-icons"></i>
</md-button>
<md-menu-content width="4">
<md-menu-item>
<md-button ng-click="ctrl.announceClick($index)"> Profile </md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="ctrl.announceClick($index)"> Messages </md-button>
</md-menu-item>
<md-menu-item>
<md-button ng-click="ctrl.announceClick($index)"> Sign Out </md-button>
</md-menu-item>
</md-menu-content>
</md-menu>
</p>
<ul id="popupContainer" class="clearfix pull-right hidden-xs">
<li><md-button class="" ng-click="newpost($event)">
Post
</md-button></li>
<li class="mesg"><img src="img/mail.svg"> </li>
<li><img src="img/macbook-wireless-mouse.jpg"> </li>
</ul>
</div>
</div>
</header>
Have you inspected it in your browser? You can see the md styles overriding it probably. Add a class to it and override style, with important if needed
.md-select.fixedTop{
top: 0px !important;
}
I think you check it
.md-select.fixedTop{ top: 0px !important; }

Move md-subheader in front of element (z-index?)

I am just starting out with web-development and consider myself to be a novice when it comes to CSS and HTML.
In the below snippet I cannot get the md-subheader to move on top of the md-fab-speed-dial. The md-fab-speed-dial is clickable through the md-subheader. How can I move either the md-subheader in front or move the md-fab-speed-dial move behind ??
<md-content style="height: 900px;" flex>
<section>
<md-subheader class="md-primary">Songs</md-subheader>
<md-list layout-padding>
<div layout="row" ng-repeat="song in songs">
<md-list-item class="md-3-line" ng-click="playSong(song)" flex>
<div class="md-list-item-text" layout="column">
<h3>{{ song.title }}</h3>
<h4>{{ song.album }}</h4>
<p>{{ song.year }}</p>
</div>
</md-list-item>
<md-fab-speed-dial md-direction="left" md-open="demo.isOpen" class="md-scale" ng-mouseenter="demo.isOpen=true" ng-mouseleave="demo.isOpen=false" style="position: relative;">
<md-fab-trigger>
<md-button aria-label="menu" class="md-fab md-primary md-hue-3">
<md-icon md-svg-src="assets/icons/queue_music.svg" aria-label="plalist"></md-icon>
</md-button>
</md-fab-trigger>
<md-fab-actions>
<md-button aria-label="add-playlist" class="md-fab md-raised md-mini" ng-click="">
<md-tooltip md-direction="top" md-visible="tooltipVisible" md-autohide="false">
Add to playlist
</md-tooltip>
<md-icon md-svg-src="assets/icons/playlist_add.svg"></md-icon>
</md-button>
</md-fab-actions>
</md-fab-speed-dial>
</div>
</md-list>
</section>
</md-content>

Material design layout CSS is not working in ui-view

I was following the starter app for material design and its working fine when try to view all the code in index.html, when I include the ui-view the layout gets distorted ..
index.html
<md-sidenav class="site-sidenav md-sidenav-left md-whiteframe-z2"
md-component-id="left"
md-is-locked-open="$mdMedia('gt-sm')">
<md-toolbar class="md-whiteframe-z1">
<h1>Users</h1>
</md-toolbar>
<md-list>
<md-list-item ng-repeat="it in ul.users">
<md-button ng-click="ul.selectUser(it)" ng-class="{'selected' : it === ul.selected }">
<md-icon md-svg-icon="{{it.avatar}}" class="avatar"></md-icon>
{{it.name}}
</md-button>
</md-list-item>
</md-list>
</md-sidenav>
<div flex layout="column" tabIndex="-1" role="main" class="md-whiteframe-z2">
<md-toolbar layout="row" class="md-whiteframe-z1">
<md-button class="menu" hide-gt-sm ng-click="ul.toggleList()" aria-label="Show User List">
<md-icon md-svg-icon="menu" ></md-icon>
</md-button>
<h1>Angular Material - Starter App</h1>
</md-toolbar>
<md-content flex id="content">
<md-icon md-svg-icon="{{ul.selected.avatar}}" class="avatar"></md-icon>
<h2>{{ul.selected.name}}</h2>
<p>{{ul.selected.content}}</p>
<md-button class="contact" md-no-ink ng-click="ul.showContactOptions($event)" aria-label="Contact User">
<md-tooltip>Contact {{ ul.selected.name }}</md-tooltip>
<md-icon md-svg-icon="share"></md-icon>
</md-button>
</md-content>
</div>
But when I inlcude the
index.html
<md-sidenav class="site-sidenav md-sidenav-left md-whiteframe-z2"
md-component-id="left"
md-is-locked-open="$mdMedia('gt-sm')">
<md-toolbar class="md-whiteframe-z1">
<h1>Users</h1>
</md-toolbar>
<md-list>
<md-list-item ng-repeat="it in ul.users">
<md-button ng-click="ul.selectUser(it)" ng-class="{'selected' : it === ul.selected }">
<md-icon md-svg-icon="{{it.avatar}}" class="avatar"></md-icon>
{{it.name}}
</md-button>
</md-list-item>
</md-list>
</md-sidenav>
<div ui-view></div>
and
source.html as
<div flex layout="column" tabIndex="-1" role="main" class="md-whiteframe-z2">
<md-toolbar layout="row" class="md-whiteframe-z1">
<md-button class="menu" hide-gt-sm ng-click="ul.toggleList()" aria-label="Show User List">
<md-icon md-svg-icon="menu" ></md-icon>
</md-button>
<h1>Angular Material - Starter App</h1>
</md-toolbar>
<md-content flex id="content">
<md-icon md-svg-icon="{{ul.selected.avatar}}" class="avatar"></md-icon>
<h2>{{ul.selected.name}}</h2>
<p>{{ul.selected.content}}</p>
<md-button class="contact" md-no-ink ng-click="ul.showContactOptions($event)" aria-label="Contact User">
<md-tooltip>Contact {{ ul.selected.name }}</md-tooltip>
<md-icon md-svg-icon="share"></md-icon>
</md-button>
</md-content>
</div>