paper-menu-button with less than two paper-items

105 views
Skip to first unread message

jan.joha...@gmail.com

unread,
Aug 27, 2014, 3:19:39 PM8/27/14
to polym...@googlegroups.com
Hello,

I've got an issue with paper-menu-button, with less than two paper-items, and I wonder if this is related to polymer, or dart-polymer, or myself not doing it right. The issue is that if I use paper-menu-button with zero paper-items, dart signals an exception (code blows up) (and chrome console signals an exception (Uncaught TypeError: Cannot read property 'offset' of undefined web-animations.js:2079)). Here is sample code that causes the exception:

                                        <paper-menu-button id="menu" icon="menu" halign="left" title="Menu">
                                        </paper-menu-button>

If I have one paper-item, then the code behaves fine, but no text is displayed for the item. Doing inspection in the browser shows that the opacity for the paper-item is set to zero; here is a copy of the inspected element (paper-item):
    <paper-item label="Menu Item 1" class="menu-item core-selected" center="" horizontal="" layout="" active="" style="opacity: 0;"></paper-item>

Here is a sample code:

                                        <paper-menu-button id="menu" icon="menu" halign="left" title="Menu">
                                                <paper-item label="Menu Item 1" class="menu-item"></paper-item>
                                        </paper-menu-button>

If I have at least two paper-items, then everything is good and works as expected. Inspecting the element (paper-item) now show (first item was selected):
    <paper-item label="Menu Item 1" class="menu-item core-selected" center="" horizontal="" layout="" style="opacity: 1;" active=""></paper-item>
    <paper-item label="Menu Item 2" class="menu-item" center="" horizontal="" layout="" style="opacity: 1;"></paper-item>

Here is a sample code:

                                        <paper-menu-button id="menu" icon="menu" halign="left" title="Menu">
                                                <paper-item label="Menu Item 1" class="menu-item"></paper-item>
                                                <paper-item label="Menu Item 2" class="menu-item"></paper-item>
                                        </paper-menu-button>

Is the paper-menu-button always expecting at least two paper-items? How should the menu be used with less than two paper-items?

I got the latest polymer and paper versions in my dart environment (dart version 1.6.0) (polymer >=0.12.0 <0.13.0, paper_elements >=0.1.0 <0.2.0, core_elements >=0.1.0 <0.2.0).

Best regards,
Jan

Yvonne Yip

unread,
Aug 27, 2014, 3:22:06 PM8/27/14
to jan.joha...@gmail.com, polymer-dev
Can you please file a bug in Polymer/paper-menu-button?


Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/3d9b0e7c-8bcb-4882-bc0f-0019db489b8e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages