Skip to content

ContextMenu + DataTable: support multiple events #13550

@NicolaIsotta

Description

@NicolaIsotta

Description

Not sure if this can be classified as a bug or feature request.
While testing the upgrade of a project fom PF 13.x to PF 15.x, I discovered a possible regression for the ContextMenu component: multiple events are no longer supported.
To enable both right and left click, our ContextMenus are configured this way:
<p:contextMenu id="contextMenu" for="dataTable1" event="click contextmenu"/>
Testing with 15.0.1, only right click triggers the menu.

Describe the solution you would like

event attribute could support a space-separated list of trigger events, just like 13.x

Additional context

Example page, can be tested with both PF 13 and PF 15:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="jakarta.faces.html"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>PrimeFaces Test</title>
        <h:outputScript name="test.js" />
        <h:outputStylesheet name="test.css" />
    </h:head>
    <h:body>
        <h:form id="frmTest">
            <p:dataTable id="dataTable" value="#{testView.list}" var="list"
                         selection="#{viewScope[selection]}" selectionMode="single" rowKey="#{list.toString()}">
                <p:column>
                    #{list.artist}
                </p:column>
                <p:column>
                    #{list.name}
                </p:column>
                <p:column>
                    #{list.released}
                </p:column>
            </p:dataTable>
            <p:contextMenu for="dataTable" event="click contextmenu">
                <p:menuitem value="Test menu item"/>
            </p:contextMenu>
        </h:form>
    </h:body>
</html>

I'll try to investigate which change triggered the regression.

Metadata

Metadata

Labels

🐞 defectBug...Something isn't working

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions