Topic: modal.directive.ts - focusOtherModals - add null check

Starceaker free asked 6 years ago


In modal.directive.ts there is no null check on the parentElement. It would be cleaner to add a check here in my opinion.
protected focusOtherModal() {
 const otherOpenedModals = this._element.nativeElement.parentElement.querySelectorAll('.in[mdbModal]');
 if (!otherOpenedModals.length) {
 return;
 }
 this._renderer.invokeElementMethod(otherOpenedModals[otherOpenedModals.length - 1], 'focus');
 }

Starceaker free answered 6 years ago


Hi Rafal The reason I mentioned this is because I received this error in my console while testing. That means it is possible to get this error. The modal is shown correctly but when closing it the console shows this error.

Rafał Rogulski free commented 6 years ago

Hi That's mean is not a problem of parentElement, is mean it's problem with closing function. Please share her example code when this error showing we will look on this. Regards

Rafał Rogulski free answered 6 years ago


Hi, It's not needed because modal always show like a child of some element, it's the only situation when modal can't have a parent but this option is blocked. Regards

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags