Material: mdSelect causes page to jump to top when clicked

Created on 24 Feb 2015  路  40Comments  路  Source: angular/material

See http://codepen.io/anon/pen/LEmgvE . Scroll down a bit, click the mdSelect to open it, and the page will scroll back to the top.

Most helpful comment

Version 1.1.4 still causes this even with Chrome.
Version 1.1.1 works fine with both Chrome and Firefox

All 40 comments

I have this issue as well.

This is still an issue as of 0.8.3, but only in Firefox

I have this same issue, and I believe its because the page somehow ignores "scrollTop" when creating / drawing the option list, i.e. the displacement of the displayed option-list is related to the amount scrolled from document top. That's the root cause of this bug, and the browser scrolling behavior comes as a side effect of this...

I would try to fix this myself if I had the time, sadly I do not. Hopefully someone else can fix it fairly quickly, since its a rather severe and UX breaking bug for (as someoene else wrote) FF users!

This is still happening for me, has anyone tested out the 0.8.3 version and notice this has been resolved?

As chr22 wrote, yes it is still in 0.8.3 but apparently only in FF (which is what I use).

I actually still have this issue on Chrome with 0.8.3 and it's been present for a few Chrome versions and a few ngMaterial versions.

Thanks @Oskar-Andersson and @ilanbiala hope to find a way around this.

I'm using 0.8.3 and this is still an issue in Chrome 41.0.2272.89 (64-bit)

Big bug that prevents mdSelect from really being usable. @ThomasBurleson @rschmukler @ajoslin any ideas what's going on?

Same here with 0.8.3.

Same here ;( I am in Chrome Version 41.0.2272.89 (64-bit)

i confirmed it's been fixed for me :cat: :zap:
thanks!

i've tested it on Safari, Chrome and Firefox (all latest releases) and it's working like a charm

@rschmukler thank you for all the work

Sorry Guys I've been having the same issue, should I wait for the next update?

Thanks

I am here with you on that @alifarahani I think we should just wait!

Thanks @Novashock ! ! !

@Novashock / @alifarahani are you running off of master or 0.8.3? It should be fixed, even though it hasn't been released yet.

@rschmukler I updated to 0.8.3 but is not fixed . . .

@alifarahani Yeah it was still in 0.8.3. But it will be fixed when we release next.

@rschmukler Thanks man keep up the good work ! ! !

i have the same issue with the 0.8.3 version. when this issue was settled?

Shall the milestone be updated for this issue? Obviously, this bug is still in 0.8.3.

Why close this issue??? It hasn't been fixed yet! Even in 0.9.4
check this:
http://codepen.io/butaixianran/pen/waWRmN

This issue is still in firefox 38+

After testing, I find out, this issue is fixed in 0.9.0, but it comes back in 0.9.4....

it's strange but this code works with firefox.

Favorite color: {{c}} You have selected {{selectedColor}}
{{c}}

I had the same issue on Chrome with a md-select in form (yesterday with the #master version). And it works for me too. Fixed height in a md-content tag. It's not "the" solution but you can go on until the great team fixe the issue ;).

Its not even fixed in 0.10.0 version, Firefox has same issue but working in chrome.

The codepen demo is now working for me in Firefox, but my actual app still has the incorrect behavior. I'll try to create another reproduction.

@dozingcat any update on this? Have you overcome this problem?

Issue still present for Chrome version 43.0.2357.134 (64-bit)

Happens to me with version 0.10.0 using mdAutocomplete in Firefox 39.0.

Just to record that 0.10.1-rc3 fixed the issue for me.

Still happening to me in 1.0.2.

md-select still is resulting in jump of page in 1.0.2. Can reproduce.

Mine jumps to top and even makes the screen completely blank angular:[email protected]

for me md-select is virtually unusable below the fold because of this (1.0.4)

So this is still happening for me. Not sure whats wrong, but it seems that styles are being placed on the body tag, the culprit being "top" set to -x value. This provides a workaround for now:

// Save mouse positions so we have them globally
$(document).mousemove(function(e) {
    window.x = e.pageX;
    window.y = e.pageY;
});

// Function needs to be placed on the md-select "md-on-open"
$rootScope.fixPosition = function(){
            $timeout(function(){
                $('body').removeAttr('style');
                if (document.getElementsByClassName('md-active')) {
                    for (var i = 0; i < document.getElementsByClassName('md-active').length; i++) {
                        var ele = document.getElementsByClassName('md-active')[i];
                        if (ele.localName == 'div') {
                            var position = y - ele.clientHeight;
                            ele.style.top = position + "px";
                        }
                    }
                }
            }, 10);
        };

Version 1.1.4 still causes this even with Chrome.
Version 1.1.1 works fine with both Chrome and Firefox

having the same issue

In FF 57.0 I and Chrome 62.0 can see an md-select inside a dialog, but cannot close it anymore.

body {
    position: initial !important;
    top: initial !important;
    overflow: initial !important;
}
html {
    overflow: initial !important;
}

worked for me.

If you are still seeing this or a similar issue, please open a new issue with a CodePen reproduction using 1.1.9.

Was this page helpful?
0 / 5 - 0 ratings