-
Notifications
You must be signed in to change notification settings - Fork 6.7k
ui-bootstrap-tpls + Accordion + FireFox + stopPropagation causes FireFox to reload page #4533
Comments
I wonder if this is related to the issue we have with tabs doing the same behavior due to the anchor tag. IIRC, this issue is that the click event is never received by angular because it's intercepted by the browser first. |
Is there a work-around? |
@alindberg, yes, the more heavy-handed approach would be to override the accordion template and instead of using You can override the accordion template via the |
@alindberg Looks like the plunk you have posted above is using the ui-bootstrap version 0.12.1? |
I believe so, however the version I am using is 0.13.4. I just updated the plunk to 0.13.4 with the same results. |
ARG! when trying to clean up the old versions, I wound up delete the plunk. I will rebuild it. Tomorrow - I have yet to figure out how to add the current libraries (angularjs 1.4.5, etc.). |
Fixed - the new plunker - http://plnkr.co/edit/NR6y4oW6UiegXUI8BL62 |
I think the heart of the problem here is that the accordion heading template wraps the heading content in an 'a'nchor element. When you start adding buttons and button like elements inside of an anchor element, you get unexpected results. |
I'm starting to think we should not officially support these use cases - this appears to be ultimately a strange case due to how Firefox operates when dealing with certain elements nested in certain other ones. The |
Here is a simplified plunk that demonstrates the problem. It's not isolated to Firefox, Chrome exhibits the same behavior. Clicking on the actual radio button does not cause the issue, it's when the stopPropagation() on the surrounding element is hit. |
It does seem to be the stopPropagation(). |
$event.stopPropagation(); is for stoping the event to reach outside elements, so you have to use it in the inner elements not in a wraper element, so use it in individual links or in the radios if you dont want both events to fire with jquery you can use delegate to surround the problem or just use the old js trick and replace with return false; it may work |
Funnily enough, I encountered this bug at work - we could switch the template to use |
@wesleycho, what do the about using Bootstrap's |
Already took a look at that before - it messes with the styling in undesirable ways...I think a div would be a lower overhead. |
I am having the same problem when using radio buttons within angular ui tabs. I added a ng-click=$event.stopPropagation to my radio button to get the radio button to show as checked when clicked upon. The solution worked in Chrome and Safari but not Firefox. In Firefox, clicking on the radio button refreshed the page. Would love to see this issue get fixed. |
@acwatson, we are in a massive push to get 1.0 out the door. There is enough information above if you want to take a stab at a PR. |
I forgot to link the commit, this is now fixed via df211bd |
Linking issues, #5361, #4777, #4104, and #3199. For the relevant conversation in Bootstrap, see this thread. |
I have a radio button in an accordion header to change how the data is presented. I have added an ngClick function($event, group) that runs
$event.stopPropagation
to prevent the accordion from closing and to allow the radio update the $scope variable. This works as expected in Chrome, IE11, but causes FireFox to reload the page and start over, losing all the created data.Please see plinker: http://plnkr.co/edit/10mS8azqb2OkueNdGuus
If you watch the FireFox console.log you will see a reboot when the radio in the 2nd accordion header is selected.
Thanks
The text was updated successfully, but these errors were encountered: