-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Update tab directive's select method to allow for event.stopPropagation() #5720
Comments
So this turns out to be not as easy as we'd like. From a logic flow perspective, it is not right that the A better solution, at the expense of API bloat, would be to add a |
Currently looking at leveraging the |
Using |
* add ability for user to prevent currently selected tab's deselction by calling `$event.preventDefault()` in tab's `deselect` callback. Fixes angular-ui#5720 Addresses angular-ui#2715, angular-ui#4836, and angular-ui#5716.
* add ability for user to prevent currently selected tab's deselection by calling `$event.preventDefault()` in tab's `deselect` callback. Fixes angular-ui#5720 Addresses angular-ui#2715, angular-ui#4836, and angular-ui#5716.
The fix doesn't work for me: evt.defaultPrevented is undefined. I figured it's because I included the full jQuery library which redefines events with a isDefaultPrevented() instead of the standard defaultPrevented. I'm not sure where the fix should take place. On one hand I think it would be nice that jQuery follows standards but on the other hand I thought angular was supposed to work fine with the full jQuery library as is... |
@daniel-jann, actually, you're sort of right. Angular found this issue as well and augmented their event object with the same method from jQuery (and even included a comment as to why):
I'm going to reopen and fix. |
* switch event handler call to look at `event.isDefaultPrevented()` instead of `event.defaultPrevented` as angular has implemented that method on jqlite events. Fixes angular-ui#5720
The current
select
method on theuibTab
directive does not allow the user to stop the selection process viaevent.stopPropagation
. We need to add anif
block to check for this and not change tabs if the user's stopped the propagation.Here's the relevant code: https://github.com/angular-ui/bootstrap/blob/master/src/tabs/tabs.js#L161-L173
We need to update the documentation as well.
This addresses comments/concerns in #2715, #4836, and #5716.
The text was updated successfully, but these errors were encountered: