-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch over focus method calls to use the renderer (#2077)
Switches the calls to `focus` directly on the DOM node to use the Renderer instead. This should make it easier to start supporting Angular Universal, if we decide to at some point.
- Loading branch information
Showing
7 changed files
with
16 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import {Directive, ElementRef} from '@angular/core'; | ||
import {Directive, ElementRef, Renderer} from '@angular/core'; | ||
|
||
|
||
/** Used in the `md-tab-group` view to display tab labels */ | ||
@Directive({ | ||
selector: '[md-tab-label-wrapper], [mat-tab-label-wrapper]' | ||
}) | ||
export class MdTabLabelWrapper { | ||
constructor(public elementRef: ElementRef) {} | ||
constructor(public elementRef: ElementRef, private _renderer: Renderer) {} | ||
|
||
/** | ||
* Sets focus on the wrapper element | ||
*/ | ||
focus(): void { | ||
this.elementRef.nativeElement.focus(); | ||
this._renderer.invokeElementMethod(this.elementRef.nativeElement, 'focus'); | ||
} | ||
} |