@firestitch/common 12.6.0 → 12.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -788,20 +788,30 @@
788
788
  this.fsAutofocus = true;
789
789
  }
790
790
  FsAutofocusDirective.prototype.ngAfterViewInit = function () {
791
- var _this = this;
792
- if (this.fsAutofocus !== false) {
793
- setTimeout(function () {
794
- _this.focus();
795
- }, 100);
791
+ if (this.fsAutofocus || this.fsAutofocus === undefined) {
792
+ this.focus();
796
793
  }
797
794
  };
798
795
  FsAutofocusDirective.prototype.focus = function () {
799
- if (this._matInput) {
800
- this._matInput.focus();
801
- }
802
- else if (this._el.nativeElement.focus) {
803
- this._el.nativeElement.focus();
804
- }
796
+ var _this = this;
797
+ setTimeout(function () {
798
+ var tmpEl = document.createElement('input');
799
+ tmpEl.style.width = '0';
800
+ tmpEl.style.height = '0';
801
+ tmpEl.style.margin = '0';
802
+ tmpEl.style.padding = '0';
803
+ tmpEl.style.border = '0';
804
+ tmpEl.style.opacity = '0';
805
+ document.body.appendChild(tmpEl);
806
+ tmpEl.focus();
807
+ if (_this._matInput) {
808
+ _this._matInput.focus();
809
+ }
810
+ else if (_this._el.nativeElement.focus) {
811
+ _this._el.nativeElement.focus();
812
+ }
813
+ document.body.removeChild(tmpEl);
814
+ }, 50);
805
815
  };
806
816
  return FsAutofocusDirective;
807
817
  }());