-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(collapse): Bootstrap3 compatibility/bugfixes #1001
Conversation
This is used by TWBS to provide support for browsers which do not have transition support, despite theoretically providing it.
Nice looking transition animations with the following browsers, on OSX 10.8.4: Chrome29.0.1547.65 FireFox19.02 FireFox23.01 FireFox26.0a1 (2013-09-04) No 'bogus state' issues with unfinished animations (that I've seen, as of yet). Unfortunately, there are some failing tests (on each browser), because some functionality had to be dropped to work well. These tests have not been rectified yet. There are some helpers for providing more robust information about the dimensions of the collapsing object, which I've included in a 'helpers' object. These should probably be either discarded, or else moved to a more central location where they can be shared by other components. Just a thought. (The implementations of these functions has been adapted from Prototype, and may not be quite as robust as jQuery).
I'll take a look at this tomorrow evening. Things have been a bit crazy with some other projects, but I really want to see collapse working :). |
Correct classes now added/removed in the no-transition path.
As far as "de-coupling from Bootstrap CSS" is concerned, I guess other code in the library has/had stuff like config objects with classes to add/remove in specific states and stuff -- But I had thought this was sort of frowned upon. So, if it's desirable we could do that (and this might shrink the code a small bit), but I'm not sure if it's really desirable |
I might be able to shrink this down a lot by relying on $position for calculating element width/height -- however, this is still not necessarily a robust solution in the presence of certain CSS property values. Would people hate me if I submitted a patch to get more reliable dimensions out of $position? I've opened an issue about this (#1036) |
@caitp Everything works great with this. I've found one behaviour I find odd but it may be intended. When the button is pressed on a mobile device and then again to close the menu, the button remains highlighted after the drawer closes. It seems to me something should be added to deselect the button after the rollup animation completes. It does deselect after you click away onto something else however. |
@routh this would depend on what you're doing exactly, however It's hard to say what's actually happening without a little more diagnostic info there, though. |
Noticed in #1153 that you said this wasn't getting much review, so for what it's worth, here's a comment from a user: I've tested this out myself and it seems to work fine on both iPad and on Chrome/Safari. Haven't run into any issues with it at all; animations seem smooth, and it works as expected. Would love to see this merged in. |
I've ran in to an error while running test. There is also a strange behavior (Chrome 30 and FF 25 on Ubuntu 13.04) where the element that should be collapse doesn't appear at once, but a guess this has to do with the transitioning that is a work in progress? Chrome 30.0 (Linux) collapse directive should collapse if isCollapsed = true with animation on subsequent use FAILED
Expected 20 to be 0.
Error: Expected 20 to be 0.
at null.<anonymous> (/home/marcellino/bootstrap-test/src/collapse/test/collapse.spec.js:37:30)
Chrome 30.0 (Linux): Executed 472 of 472 (1 FAILED) |
Testing on my Ubuntu 13.04 machine, I'm getting all green tests. It might be flaky (but it shouldn't be due to flushing $timeout). So you're saying you can actually see the element not appearing at once, but with no animation? Eg you click, there is a latency, and then the element suddenly is shown? Or do you just mean in the test you're apparently getting that behaviour |
To check if I did anything wrong re-cloned your branch and tried it again but I get the same result. To properly show you the effect I've made a screen capture of it in Chrome and Firefox. http://youtu.be/Ow8oFCITsVI |
does the documentation include the bootstrap 3 css? The only browsers you should see this effect with, using the stock Bootstrap3 css, is Firefox prior to version 17, and Opera prior to whichever version they unprefixed in. And IE pre-9 or 10, I guess. Looks like the docs are (unless you modified them) loading http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap.css This CSS works a bit differently from the v3.0.0 CSS, so it makes sense that you're seeing this behaviour in the demo |
Having a facepalm moment, forgot to check that. I will check it again tomorrow. |
Working for long hours is still counter productive, but I've tested it again and it seems to work in Chrome. When I tested it in Firefox and IE10 I noticed that the opening goes with a transition, but the closing does not and it does collapse immediately. Testing IE9 was not possible because it crashes when I opened my Plunk each time.. http://plnkr.co/edit/qO3YNH?p=preview |
Yeah, I've seen this working correctly on FF17+ (prior versions would not animate with the stock bootstrap CSS due to requiring the -moz- prefix'd transition) -- so I'll have to investigate your markup a bit. I'm seeing the opposite issue, where closing animations are shown, but we are opening instantaneously (tested in FF17 and FF26, same issue both times). On 2013-10-16, at 7:49 AM, Marcellino van Hecke [email protected] wrote:
|
Interestingly, if you add This is a CSS issue, because the JS does not care about the "container" class being present. I guess we need to ensure that the appropriate properties are available |
@Gamemaniak to use Plunker on IE9 just use the run URI, in your case http://run.plnkr.co/plunks/qO3YNH/ , it's a known issue 😦 Anyway this issue is much needed, 👍 for all your efforts |
@caitp, all - finally I had a bit of time to look into the collapse thing, both for BS2 and BS3. Here is my take: I'm probably skipping some important use-cases since my code is rather concise. I'm especially worried about this @caitp comment about Guys, could you please have a look at the provided code and help me spot any deficiencies? This code still needs some love to remove code duplication and add unit tests but it seems to work ok, at least in modern browsers. |
So, it's not so much "unreliable" as it is "not necessarily the appropriate measure". At this point though, if the solution is many fewer lines of code, I'm all for it. I'm happy to poke around it today and see if I can break it with anything. On the way out, here are some MDN snippets Lets read MDN (where the editors seem to not be entirely sure about this either! maybe someone can find dbaron or something and ask him)
|
@caitp not sure what has happened but GitHub decided to close this PR when I've pushed a rebased version of the bootstrap3 branch :-( In any case I'm going to open a new PR with a cleaned up version of the code from the plunker I've attached earlier today. Thnx for all the work on this, I really appreciate! |
@pkozlowski-opensource I just did some testing on the bootstrap_collapse branch, and I noticed that if you start off with your content collapsed, the first time it opens there's no animation; just just pops open. After that initial time, it always animates. Oddly, if you start with your content expanded, it always animates. This can be seen here: http://plnkr.co/edit/ixOYAn4yqwNBeSECQLTo?p=preview (forked from your previous plunkr post.) |
@Morgul yup, this impl still needs some love, working on it as we speak. Here is a plunk with a fixed version: |
Thanks! That worked great. |
I'm working on a slimmed down version which will use ngAnimate rather than $transition, to enhance on the already merged work. It's a bit shaky so far, but I'll try to finish that up tomorrow |
Good thing is that a plunk by Pawel Kozlowski still works after changing AngularJS version to 1.1.15 and adding the reference to ui-bootstrap-tpls-0.6.0.js. |
Same issues as #934:
Short of this, tests are passing, and from what I've seen, we're getting
good behaviour from all browsers. So this is good.
See #934 for other work on this same problem, I'd like to get this merged
in, for the benefit of my own apps and everyone elses :]
Passing on Travis-CI