Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2.2.0rc1] bootstrap modal dialog #426

Closed
krikunts opened this issue May 26, 2015 · 18 comments
Closed

[2.2.0rc1] bootstrap modal dialog #426

krikunts opened this issue May 26, 2015 · 18 comments

Comments

@krikunts
Copy link
Member

When I use autocomplete input with bootstrap modal dialog, choices are displayed behind the dialog.
However, it is just fine in previous release (2.1.1).

@jpic
Copy link
Member

jpic commented May 27, 2015

Try changing z-index. Does it work ?

@krikunts
Copy link
Member Author

I've traced this issue to the 61e54ee. The cause is new version of fixPosition function in autocomplete.js.
The old one appended span with choices just after the input, so I suppose it was z-ordered automatically just like its parents.
The new function appends this span at the end of the body section. It looks ok in most cases but it's not when you use autocomplete in z-ordered elements like dialogs.

@krikunts
Copy link
Member Author

Oh, and yes, for modal dialog it is rendered ok when z-index > 1050, but I think this is not the thing to be hardcoded in css because we don't know what maximum z-index could be enough.

@jpic
Copy link
Member

jpic commented May 27, 2015

Ok so what if we set z-index of the autocomplete to be equal to the one calculated for the input, would that work ?

@krikunts
Copy link
Member Author

The z-index may be set not for the input but for one of its parents. If you get input's z-index, it will get you "auto" so this won't help.

jpic added a commit that referenced this issue May 27, 2015
@jpic
Copy link
Member

jpic commented May 27, 2015

Could you try with fix/zindex branch ?

I don't have a bootstrap project with an autocomplete in a modal window, there is none in test_project, I don't have time to make one for the moment, maybe after Djangocon. So your help is welcome on this.

@krikunts
Copy link
Member Author

Ok, with this fix it works in Firefox. But I've discovered that Chrome and Opera adds some random 0 z-indexes in addition to "auto" values. So this code will do the trick:

var zIndex = this.input.parents().filter(function() {
    return $(this).css('z-index') != 'auto' && $(this).css('z-index') != 0;
}).first().css('z-index');

@jpic
Copy link
Member

jpic commented May 28, 2015

Didn't see your reply and was about to ping you about this heh

Pretty awesome, I'm packing that with a couple of bugfixes in rc3 ASAP.

jpic added a commit that referenced this issue May 28, 2015
@jpic
Copy link
Member

jpic commented May 28, 2015

Please could you try with 2.2.0rc4 ? I've included your fix and credited you in CHANGELOG.

Thanks

@krikunts
Copy link
Member Author

The problem with z-index is fixed with 2.2.0rc4. Thank you for your time.
I added bootstrap_modal example in my fork https://github.com/lucky-user/django-autocomplete-light

During the tests I found another issue #431 related to the absolute positioning.

@jpic
Copy link
Member

jpic commented May 29, 2015

Yes, thanks for the example !

@jpic jpic closed this as completed May 29, 2015
jpic added a commit to yourlabs/jquery-autocomplete-light that referenced this issue May 30, 2015
@marianobianchi
Copy link
Member

I'm having this problem with jquery ui dialog. I can't see autocomplete options when writing things on the autocomplete input. Nevertheless, if i hit "enter" i get the expected result (one option selected and correctly displayed instead of the text input). I'm using django-autocomplete-light==2.2.3, jquery-ui==1.9.2, and jquery==1.10.2.

I tried using django-autocomplete-light==2.1.1 and it works fine. Do you know what the problem could be?

@jpic
Copy link
Member

jpic commented Jul 22, 2015

The problem with the way 2.1.1 works is that it's not supported in some cases in django admin.

Ideally, we'd support both methods, using the overflow: hidden method for django admin and using the clearfix method for modern css integration.

Pull requests would be welcome.

@marianobianchi
Copy link
Member

I don't understand: is this still an issue in versions >= 2.2? If it is, is there any open issue for this bug?

@jpic
Copy link
Member

jpic commented Jul 22, 2015

Details in the CHANGELOG would help ?

@marianobianchi
Copy link
Member

There is a comment in CHANGELOG that says:

2.2.0rc3

What i understand is that this bug was fixed in version 2.2.0rc3. But with version 2.2.3 i'm still getting this bug. So i don't understand if it is this bug that wasn't fixed or if it is a problem with my code.

@jpic
Copy link
Member

jpic commented Jul 22, 2015

I was talking about:

2.2.0rc1

CSS BREAK

We've moved back to pre-1.1.10 CSS positioning. This means appending the
autocomplete box to an arbitrary DOM element (body by default) and using
calculating the ``top`` and ``bottom`` attribute in javascript with
``yourlabs.Autocomplete.fixPosition()`` pretty much like Django admin's
calendar widget does. While blunt, this change should help the widget

being
more compatible across Django admin themes.

While this positioning system has been used since around 2005 in Django
when Adrian Holovaty open sourced admin media in commit dd5320d, it has
never been documented that's it's a good system that works well and

there's
no reason to break backward compatibility in Django admin for that
- note to Django admin template customizers.

@jpic
Copy link
Member

jpic commented Jul 22, 2015 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants