<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Open adf-document-list's context menu on click instead of right click in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/open-adf-document-list-s-context-menu-on-click-instead-of-right/m-p/22084#M9683</link>
    <description>&lt;P&gt;Hello Team,&lt;BR /&gt;&lt;BR /&gt;I am using&amp;nbsp; ADF 6.10 (&lt;A href="https://github.com/Alfresco/alfresco-content-app" target="_blank" rel="noopener nofollow noreferrer"&gt;Alfresco Content App&lt;/A&gt;), Alfresco Content Services 23.2.&lt;BR /&gt;I have found that Alfresco file list component (&lt;STRONG&gt;files.component.html&lt;/STRONG&gt;), that have&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;adf-document-list&lt;/STRONG&gt; component which opens context menu on right click,&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;adf-document-list
          #documentList
          acaDocumentList
          acaContextActions
          [selectionMode]="'multiple'"
          [multiselect]="true"
          [currentFolderId]="node?.id"
          [loading]="true"
          [showHeader]="showHeader"
          [node]="nodeResult"
          [allowDropFiles]="true"
          [navigate]="false"
          [sorting]="['name', 'asc']"
          [imageResolver]="imageResolver"
          [headerFilters]="true"
          [filterValue]="queryParams"
          [isResizingEnabled]="true"
          [blurOnResize]="false"
          (node-dblclick)="handleNodeClick($event)"
          (name-click)="handleNodeClick($event)"
          (filterSelection)="onFilterSelected($event)"
          (error)="onError()"
        &amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;It's using directive&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;acaContextActions &lt;/SPAN&gt;&lt;/STRONG&gt;which is&amp;nbsp;&lt;SPAN&gt;having&amp;nbsp;HostListener which opens context menu on right click&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt; @HostListener('contextmenu', ['$event'])
  onContextMenuEvent(event: MouseEvent) {
    if (event) {
      event.preventDefault();

      if (this.enabled) {
        const target = this.getTarget(event);
        if (target) {
          this.execute(event, target);
        }
      }
    }
  }&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I tried by putting &lt;STRONG&gt;click&lt;/STRONG&gt; event&amp;nbsp;HostListener - @HostListener('click', ['$event']), but it is not working properly.&lt;BR /&gt;It opens context menu but it blocks the multiselect feature of file / folder selection because it's listen click event and prevents the checkbox events.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 328px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/146iB11F30FD42B6DA99/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;It also sometimes opens contextmenu but it takes the wrong row / node reference and opens context menu of other nodes.&lt;BR /&gt;&lt;BR /&gt;I also tried with &lt;STRONG&gt;mousedown&lt;/STRONG&gt; event as well but none of them are working properly.&lt;/P&gt;&lt;PRE&gt;  @HostListener('click', ['$event'])
  onContextMenuClickEvent(event: MouseEvent) {
    if (event.which !== 3) {
      event.preventDefault();
      if (this.enabled) {
        const target = this.getTargetFromEvent(event);
        if (target) {
          if (this.isEmptyTable(target)) {
            return null;
          }
          this.execute$.next(event);
        }
      }
    }
  }&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I wanted to implement the same behaviour of conext menu as we got the menu items on right click by doing a click.&lt;BR /&gt;Please help / suggest the customization or changes required to achieve this solution.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Vikash&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jun 2024 04:37:49 GMT</pubDate>
    <dc:creator>vikash_patel</dc:creator>
    <dc:date>2024-06-27T04:37:49Z</dc:date>
    <item>
      <title>Open adf-document-list's context menu on click instead of right click</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/open-adf-document-list-s-context-menu-on-click-instead-of-right/m-p/22084#M9683</link>
      <description>&lt;P&gt;Hello Team,&lt;BR /&gt;&lt;BR /&gt;I am using&amp;nbsp; ADF 6.10 (&lt;A href="https://github.com/Alfresco/alfresco-content-app" target="_blank" rel="noopener nofollow noreferrer"&gt;Alfresco Content App&lt;/A&gt;), Alfresco Content Services 23.2.&lt;BR /&gt;I have found that Alfresco file list component (&lt;STRONG&gt;files.component.html&lt;/STRONG&gt;), that have&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;adf-document-list&lt;/STRONG&gt; component which opens context menu on right click,&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;adf-document-list
          #documentList
          acaDocumentList
          acaContextActions
          [selectionMode]="'multiple'"
          [multiselect]="true"
          [currentFolderId]="node?.id"
          [loading]="true"
          [showHeader]="showHeader"
          [node]="nodeResult"
          [allowDropFiles]="true"
          [navigate]="false"
          [sorting]="['name', 'asc']"
          [imageResolver]="imageResolver"
          [headerFilters]="true"
          [filterValue]="queryParams"
          [isResizingEnabled]="true"
          [blurOnResize]="false"
          (node-dblclick)="handleNodeClick($event)"
          (name-click)="handleNodeClick($event)"
          (filterSelection)="onFilterSelected($event)"
          (error)="onError()"
        &amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;It's using directive&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;acaContextActions &lt;/SPAN&gt;&lt;/STRONG&gt;which is&amp;nbsp;&lt;SPAN&gt;having&amp;nbsp;HostListener which opens context menu on right click&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt; @HostListener('contextmenu', ['$event'])
  onContextMenuEvent(event: MouseEvent) {
    if (event) {
      event.preventDefault();

      if (this.enabled) {
        const target = this.getTarget(event);
        if (target) {
          this.execute(event, target);
        }
      }
    }
  }&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I tried by putting &lt;STRONG&gt;click&lt;/STRONG&gt; event&amp;nbsp;HostListener - @HostListener('click', ['$event']), but it is not working properly.&lt;BR /&gt;It opens context menu but it blocks the multiselect feature of file / folder selection because it's listen click event and prevents the checkbox events.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 328px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/146iB11F30FD42B6DA99/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;It also sometimes opens contextmenu but it takes the wrong row / node reference and opens context menu of other nodes.&lt;BR /&gt;&lt;BR /&gt;I also tried with &lt;STRONG&gt;mousedown&lt;/STRONG&gt; event as well but none of them are working properly.&lt;/P&gt;&lt;PRE&gt;  @HostListener('click', ['$event'])
  onContextMenuClickEvent(event: MouseEvent) {
    if (event.which !== 3) {
      event.preventDefault();
      if (this.enabled) {
        const target = this.getTargetFromEvent(event);
        if (target) {
          if (this.isEmptyTable(target)) {
            return null;
          }
          this.execute$.next(event);
        }
      }
    }
  }&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I wanted to implement the same behaviour of conext menu as we got the menu items on right click by doing a click.&lt;BR /&gt;Please help / suggest the customization or changes required to achieve this solution.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Vikash&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jun 2024 04:37:49 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/open-adf-document-list-s-context-menu-on-click-instead-of-right/m-p/22084#M9683</guid>
      <dc:creator>vikash_patel</dc:creator>
      <dc:date>2024-06-27T04:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Open adf-document-list's context menu on click instead of right click</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/open-adf-document-list-s-context-menu-on-click-instead-of-right/m-p/22085#M9684</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;A href="https://migration33.stage.lithium.com/t5/user/viewprofilepage/user-id/75132"&gt;@vikash_patel&lt;/A&gt;&lt;A href="https://www.aarp-membership.com" target="_self" rel="nofollow noopener noreferrer"&gt;AarpMembership&lt;/A&gt; wrote:&lt;BR /&gt;&lt;P&gt;Hello Team,&lt;BR /&gt;&lt;BR /&gt;I am using&amp;nbsp; ADF 6.10 (&lt;A href="https://github.com/Alfresco/alfresco-content-app" target="_blank" rel="noopener nofollow noreferrer"&gt;Alfresco Content App&lt;/A&gt;), Alfresco Content Services 23.2.&lt;BR /&gt;I have found that Alfresco file list component (&lt;STRONG&gt;files.component.html&lt;/STRONG&gt;), that have&amp;nbsp;&lt;SPAN&gt;&lt;STRONG&gt;adf-document-list&lt;/STRONG&gt; component which opens context menu on right click,&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&amp;lt;adf-document-list
          #documentList
          acaDocumentList
          acaContextActions
          [selectionMode]="'multiple'"
          [multiselect]="true"
          [currentFolderId]="node?.id"
          [loading]="true"
          [showHeader]="showHeader"
          [node]="nodeResult"
          [allowDropFiles]="true"
          [navigate]="false"
          [sorting]="['name', 'asc']"
          [imageResolver]="imageResolver"
          [headerFilters]="true"
          [filterValue]="queryParams"
          [isResizingEnabled]="true"
          [blurOnResize]="false"
          (node-dblclick)="handleNodeClick($event)"
          (name-click)="handleNodeClick($event)"
          (filterSelection)="onFilterSelected($event)"
          (error)="onError()"
        &amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;It's using directive&amp;nbsp;&lt;STRONG&gt;&lt;SPAN&gt;acaContextActions &lt;/SPAN&gt;&lt;/STRONG&gt;which is&amp;nbsp;&lt;SPAN&gt;having&amp;nbsp;HostListener which opens context menu on right click&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;&lt;STRONG&gt; @HostListener('contextmenu', ['$event'])
  onContextMenuEvent(event: MouseEvent) {
    if (event) {
      event.preventDefault();

      if (this.enabled) {
        const target = this.getTarget(event);
        if (target) {
          this.execute(event, target);
        }
      }
    }
  }&lt;/STRONG&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;BR /&gt;I tried by putting &lt;STRONG&gt;click&lt;/STRONG&gt; event&amp;nbsp;HostListener - @HostListener('click', ['$event']), but it is not working properly.&lt;BR /&gt;It opens context menu but it blocks the multiselect feature of file / folder selection because it's listen click event and prevents the checkbox events.&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 328px;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://connect.hyland.com/t5/image/serverpage/image-id/146iB11F30FD42B6DA99/image-size/large?v=v2&amp;amp;px=999" role="button" title="image" alt="image" /&gt;&lt;/span&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;It also sometimes opens contextmenu but it takes the wrong row / node reference and opens context menu of other nodes.&lt;BR /&gt;&lt;BR /&gt;I also tried with &lt;STRONG&gt;mousedown&lt;/STRONG&gt; event as well but none of them are working properly.&lt;/P&gt;&lt;PRE&gt;  @HostListener('click', ['$event'])
  onContextMenuClickEvent(event: MouseEvent) {
    if (event.which !== 3) {
      event.preventDefault();
      if (this.enabled) {
        const target = this.getTargetFromEvent(event);
        if (target) {
          if (this.isEmptyTable(target)) {
            return null;
          }
          this.execute$.next(event);
        }
      }
    }
  }&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I wanted to implement the same behaviour of conext menu as we got the menu items on right click by doing a click.&lt;BR /&gt;Please help / suggest the customization or changes required to achieve this solution.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Vikash&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;To achieve the desired behavior of opening the context menu on a left-click instead of a right-click while maintaining the multiselect functionality, you can modify the event handling in your ADF component. Here's a step-by-step approach:&lt;/P&gt;&lt;P&gt;Step 1: Update the HostListener&lt;BR /&gt;You want to handle both the left-click for the context menu and also ensure that checkbox selections are working correctly.&lt;/P&gt;&lt;P&gt;Handle Click Event for Context Menu:&lt;/P&gt;&lt;P&gt;Instead of using the @HostListener('click', ['$event']) to open the context menu directly, you'll want to check if the click is on a valid item and also check if it interferes with selection behavior.&lt;/P&gt;&lt;P&gt;Here’s a way to do this:&lt;/P&gt;&lt;P&gt;@HostListener('click', ['$event'])&lt;BR /&gt;onContextMenuClickEvent(event: MouseEvent) {&lt;BR /&gt;const target = this.getTargetFromEvent(event);&lt;/P&gt;&lt;P&gt;// Check if the target is a valid node item&lt;BR /&gt;if (target &amp;amp;&amp;amp; this.enabled) {&lt;BR /&gt;event.preventDefault();&lt;/P&gt;&lt;P&gt;// Open the context menu if it is not a checkbox click&lt;BR /&gt;if (!this.isCheckboxClick(event)) {&lt;BR /&gt;this.execute$.next(event);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;private isCheckboxClick(event: MouseEvent): boolean {&lt;BR /&gt;// Check if the click is on a checkbox&lt;BR /&gt;return event.target instanceof HTMLInputElement &amp;amp;&amp;amp; event.target.type === 'checkbox';&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Step 2: Adjust the Context Menu Logic&lt;BR /&gt;Modify the context menu logic:&lt;/P&gt;&lt;P&gt;When opening the context menu, ensure that it references the correct node. Make sure your execute function or observable is correctly identifying the target node based on the event.&lt;/P&gt;&lt;P&gt;If you're using a method to determine which node to use for the context menu, ensure that it accurately captures the clicked node's information.&lt;/P&gt;&lt;P&gt;Step 3: Ensure Multiselect Works&lt;BR /&gt;Handle Multiselect:&lt;/P&gt;&lt;P&gt;You want to maintain the ability to select multiple items. Ensure that your click handler allows checkbox clicks to be processed normally&lt;BR /&gt;private getTargetFromEvent(event: MouseEvent): any {&lt;BR /&gt;// Implement your logic to find the target node from the event&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Step 4: Integrate the Logic into Your Component&lt;BR /&gt;Finally, integrate the modified logic into your adf-document-list component.&lt;/P&gt;&lt;P&gt;Step 5: Test Your Implementation&lt;BR /&gt;Test clicking on document items to ensure that the context menu opens correctly without interfering with checkbox selections.&lt;BR /&gt;Ensure that multiselect still works as intended.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;JennieF&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Sep 2024 06:08:51 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/open-adf-document-list-s-context-menu-on-click-instead-of-right/m-p/22085#M9684</guid>
      <dc:creator>jennie258fitz</dc:creator>
      <dc:date>2024-09-20T06:08:51Z</dc:date>
    </item>
  </channel>
</rss>

