Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Uncaught TypeError: Cannot read property 'position' of null #11

Open
pawelstep opened this issue Nov 11, 2014 · 2 comments
Open

Uncaught TypeError: Cannot read property 'position' of null #11

pawelstep opened this issue Nov 11, 2014 · 2 comments

Comments

@pawelstep
Copy link

Hi,
when clicking frequently on core-dropdown with paper elements, a null error appears on console.
I guess this is because rendering of paper elements takes a while with its fancy animations, but a new click in the dropdown causes that to happen. The sample code attached below - tried in Chrome "Version 38.0.2125.111 m", on PC/Win7. It is enough to make a series of quick double-clicks on dropdown to get an error msg in console.

Would some kind of check for null or action deferral be needed?

Best regards,
PawelS.

<polymer-element name="login-info" attributes="loggedin user" noscript>
    <template>
            <template if='{{loggedin}}'>
                <paper-menu-button>
                    <paper-item>
                        <span class="puser">User: {{user}}</span>
                    </paper-item>
                    <paper-dropdown class="dropdown">
                        <paper-item>
                            <span class="puser">User: {{user}}</span>
                        </paper-item>
                        <paper-item on-click="{{buttonOnLogout}}">LogOut</paper-item>
                    </paper-dropdown>
                </paper-menu-button>
            </template>
    </template>
</polymer-element>
@pawelstep
Copy link
Author

polymercoredropdownerr

That's the error image.

@Ortham
Copy link

Ortham commented Nov 17, 2014

I also get the same error: it's present in core-dropdown.html on line 186 in Polymer 0.5.1.

From what I can tell, the error is Cannot read property 'position' of null if you open one menu quickly after another, but I can also get a Cannot read property 'position' of undefined on the same line.

I'm not sure what the case for the latter happening is, but I'm opening <paper-dropdown> menus in <core-list> items, where the items can reset the dropdown state, so maybe that's happening because the <core-dropdown> code doesn't realise the open menus have been closed via Javascript, or vice versa?

Edit: PR #14 fixes this for me.

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

No branches or pull requests

2 participants