PolymerElements / paper-dropdown-menu

A Material Design browser select element
https://www.webcomponents.org/element/PolymerElements/paper-dropdown-menu
61 stars 107 forks source link

Fallback to nested textContent #210

Open mkazlauskas opened 7 years ago

mkazlauskas commented 7 years ago

Description

Currently paper-dropdown-menu will only fallback to textContent that is set from current template. This is only useful for simple use cases, where you set everything in same template. If you wanted to have something like:

<paper-dropdown-menu>
  <paper-listbox>
    <paper-item>
     <load-unknown-text-content></load-unknown-text-content>
    </paper-item>
  </paper-listbox>
</paper-dropdown-menu>

It would not fallback to it's text content because <load-unknown-text-content> is in it's own shadow root. It means that we would have to set the label manually introducing additional bindings.

I suggest improving it in 2.0: iterating over nested shadow roots and constructing the fallback from all available text content.

See this example implementation.

Who will use the feature?

Developers using Polymer and paper-dropdown-menu

When will they use the feature?

When selected item is complex - has it's own content that doesn't belong in current template.

What is the user’s goal?

I want paper-dropdown-menu to intuitively use all textContent in selectedItem - not just the distributed nodes from current template.