Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: ion-reorder prevents click event when ion-reorder-group is disabled #21017

Closed
gr99t opened this issue Apr 12, 2020 · 6 comments · Fixed by #21947
Closed

bug: ion-reorder prevents click event when ion-reorder-group is disabled #21017

gr99t opened this issue Apr 12, 2020 · 6 comments · Fixed by #21947
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@gr99t
Copy link

gr99t commented Apr 12, 2020

Bug Report

Ionic version:
[x] 5.x

Current behavior:
If ion-reorder-group is disabled, all elements affected by ion-reorder that also have a click event are not working

Expected behavior:
If ion-reorder-group is disabled also disable ion-reorders click prevention

Related code:
Repo: (https://github.com/gr99t/ionic-reorder-card)

Ionic info:

Ionic:

   Ionic CLI                     : 6.5.0
   Ionic Framework               : @ionic/angular 5.0.7
   @angular-devkit/build-angular : 0.803.26
   @angular-devkit/schematics    : 8.3.26
   @angular/cli                  : 8.3.26
   @ionic/angular-toolkit        : 2.2.0

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   NodeJS : v12.14.1 
   npm    : 6.13.4
   OS     : Windows 10
@ionitron-bot ionitron-bot bot added the triage label Apr 12, 2020
@NikolaPeevski
Copy link

NikolaPeevski commented Apr 12, 2020

As a workaround you can wrap only your button in a ion-reorder

              <ion-reorder *ngIf="!reorderDisabled">
                <ion-icon slot="start" name="reorder-three"></ion-icon>
              </ion-reorder>

It's most likely stripping the click events due to adding it's own click events for draggable.

@liamdebeasi
Copy link
Contributor

Thanks for the issue. Can you clarify the issue you are running into?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Apr 13, 2020
@ionitron-bot ionitron-bot bot removed the triage label Apr 13, 2020
@gr99t
Copy link
Author

gr99t commented Apr 13, 2020

Sure,

let's take the example from my repo, the ion-card has a click event bound to it:
<ion-card mode="md" *ngFor="let message of getMessages()" (click)="openMessage(message.id)" button>

When you run the app the ion-reorder-group is disabled, so no reordering is possible and when you click the card nothing is happening because the ion-reorder prevents all click events
https://github.com/ionic-team/ionic/blob/102a842bd2a967c04a3cf42ed4e0811929bd4d99/core/src/components/reorder/reorder.tsx#L15

If you enable the reordering everything just works as expected - click events from the wrapped element is prevented and only reordering is possible.

This also applies to simpler cases like an ion-item wrapped by an ion-reorder

<ion-reorder-group (ionItemReorder)="reorderItem($event.detail)" [disabled]="reorderDisabled">
    <ion-reorder *ngFor="let message of getMessages()">
      <ion-item (click)="openMessage(message.id)">
        <ion-label>{{ message.fromName }}</ion-label>
      </ion-item>
    </ion-reorder>
  </ion-reorder-group>

My assumption was that the ion-reorder-group is forwarding its disabled state to the ion-reorder and disable the click/propagation prevention

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Apr 13, 2020
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Apr 13, 2020
@ionitron-bot ionitron-bot bot removed the triage label Apr 13, 2020
@denkomanceski
Copy link

I have the exact problem 👍

@pkunszt
Copy link

pkunszt commented Sep 10, 2020

Same problem. Currently i have to implement list reordering without ion-reorder because of this.

brandyscarney pushed a commit that referenced this issue Sep 24, 2020
…abled (#21947)

Allow interactive components (e.g `<ion-checkbox>`) inside of an `<ion-reorder>` tag in a disabled `<ion-reorder-group>` to fire click events / have their state changed. 

fixes #21017
@ionitron-bot
Copy link

ionitron-bot bot commented Oct 24, 2020

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Oct 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants