mgcrea / angular-strap

AngularJS 1.2+ native directives for Bootstrap 3.
mgcrea.github.io/angular-strap
MIT License
5.73k stars 1.38k forks source link

Check tipElement before use to prevent "Cannot read property 'on' of null" #2269

Closed mskiy closed 5 years ago

mskiy commented 6 years ago

https://github.com/mgcrea/angular-strap/blob/fca7e33c3ec5155d82c73af097740332a84d3473/src/tooltip/tooltip.js#L492

We have to check tipElement before use to prevent null reference exception, I found the issue when we use bs-popover directive for hundred cells in the quite big table and move mouse very quick over the element and so tipElement is null.

image

melcher commented 6 years ago

I believe there's a closely related error when there's no tipElement and the trigger was not 'focus', causing a slightly earlier error in tipElement[0].focus() from this line:

https://github.com/mgcrea/angular-strap/blob/master/dist/modules/tooltip.js#L261

image

I believe the same fix should apply, e.g. tipElement && tipElement[0].focus();; I can open a separate ticket for this if it's helpful to track separately.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

lock[bot] commented 5 years ago

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.