Uploaded image for project: 'Nuxeo Elements'
  1. Nuxeo Elements
  2. ELEMENTS-1033

Make nuxeo-actions-menu compatible with native HTML slots

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0.x
    • Component/s: Actions, Slots

      Description

      nuxeo-actions-menu does not work properly if a native HTML slot is used as slotted content.

      Take the following custom element into consideration:

          class CustomSlottedMenuElement extends Nuxeo.Element {
            static get is() {
              return 'my-custom-slotted-menu-element';
            }
      
            static get template() {
              return polymer.html`
                <div style="max-width: 160px;">
                  <nuxeo-actions-menu>
                    <slot>
                      <nuxeo-slot slot="SLOT"></nuxeo-slot>
                    </slot>
                  </nuxeo-actions-menu>
                </div>
              `;
            }
          }
          customElements.define(CustomSlottedMenuElement.is, CustomSlottedMenuElement);
      

      And the following use case:

        <my-custom-slotted-menu-element>
          <nuxeo-preview-button document='{...}'></nuxeo-preview-button>
          <nuxeo-preview-button document='{...}'></nuxeo-preview-button>
          <nuxeo-preview-button document='{...}'></nuxeo-preview-button>
          <nuxeo-preview-button document='{...}'></nuxeo-preview-button>
          <nuxeo-preview-button document='{...}'></nuxeo-preview-button>
        </my-custom-slotted-menu-element>
      

      Note that the children will be inside my-custom-slotted-menu-element's light DOM, and not inside the menu's, and also that the menu changes the actions' slot to "dropdown" when it needs to move them to the dropdown. Because the "dropdown" slot does not exist in the context of my-custom-slotted-menu-element, the actions disappear when the menu moves them to the "dropdown" slot.

      A possible fix would be to wrap the actions in a custom menu action item element, whose parent is the action menu, and thus can be moved around with slot changes. However, this means that the action would have a different parent, which is likely to create issues with nuxeo slots and filters.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                gbarata Gabriel Barata
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h

                    PagerDuty