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

Fix bug where dropdowns pointing upwards were incorrectly positioned #5621

Merged
merged 1 commit into from Aug 28, 2019

Conversation

kevin-brown
Copy link
Member

This pull request includes a

  • Bug fix
  • New feature
  • Translation

The following changes were made

  • Switch back to doing late binds for the positioning handlers for dropdowns

If this is related to an existing ticket, include a link to it as well.

Fixes #5619
Fixes #5620

This is how it used to work pre-4.0.9, where the bound handlers for
resizing and positioning the dropdown were bound at the first time
that the dropdown was opened. This was changed for the 4.0.9 release
as a part of 3f75227 where it was not clear why this late binding
was happening, so it was removed to simplify the code.

The late binding is necessary because the handlers within results for
generating the results, and thus the content within the dropdown,
are bound after the handlers for the dropdown are bound. This results
in situations where the handlers for positioning the dropdown are
bound before the dropdown is updated with content, resulting in the
positioning being calculated for the old content and thus being
incorrectly placed. By binding the positioning handlers after the
dropdow is opened for the first time, we can ensure that the
positioning handlers are bound after the result handlers, so we
won't have to worry about this issue.

The handlers are only bound once because they only need to perform
all the calculations a single time. There is no need to keep checking
all of the calculated styles more than we need to, so this is guarded
by a flag which ensures it is only bound a single time per dropdown.

Fixes #5619
Fixes #5620
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant