-
-
Notifications
You must be signed in to change notification settings - Fork 424
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
dropdown.js " - wrapperRect.top" is useless #275
Comments
Thanks for the heads up. Does this cause a problem with the Dropdown component or is it just unnecessary code? |
@amorey this is what I do: var handleDropdownButton = function (evt) {
evt.stopPropagation();
evt.preventDefault();
var _this = this;
var dropdownMenu = _this.nextElementSibling;
var dropdownButtonRect = _this.getBoundingClientRect();
var top = dropdownButtonRect.top + dropdownButtonRect.height;
var left = dropdownButtonRect.left;
if (dropdownMenu) {
dropdownMenu[style].top = top + "px";
if (!dropdownMenu[classList].contains("mui-dropdown__menu--right")) {
dropdownMenu[style].left = left + "px";
} |
Hi @englishextra - what do you mean by In any case, taking a closer look at the code I think we can remove the references to var top = toggleEl.offsetHeight; Let me know if there's something I'm not understanding with this issue. |
@amorey wrapperRect.top is not 0 only after the UL reveals that is gets display block. Perhaps yes as it's said in verge.js issue if (verge.inViewport(e) && 0 !== e.offsetHeight) { Well the code that I presented works fine for me. So you decide whichever is appropriate. |
@englishextra Here's a pull request that should fix this issue: #277 Let me know if you notice any problems with the new code. |
@englishextra Have you had a chance to look at pull request #277? |
@amorey Hi. Yes, As I understand you have solved the issue completely in a new mananer. But sorry I haven't studied the code closely. I will very soon. Thanks for your quick responses. |
While UL with menu items stays display none it has no top value at all which is 0.
It gets a value other than 0 only if the UL is revealed - display block for instance.
So:
is the same as:
See this issue here ryanve/verge#19 to get the picture what's going on.
Thanks.
The text was updated successfully, but these errors were encountered: