ionic-team / ionic-team/ionic-framework

bug: react, mixing nested controller and inline overlays causes event handlers to not get bound

オープン
#28,819 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
package: react type: bug
主要言語
TypeScript
スター
52.7k
フォーク
13.3k
平均マージ
1日 15時間
マージ済み PR(30日)
51

説明

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

v7.x

### Current Behavior

* Create and present a modal using controller method

```
const [present, dismiss] = useIonModal(ModalExample)
...
function openModal() {
present();
}
...
```

* From within the modal have a button that triggers an IonPopover

```
...
Trigger Popover


Hello World!
I'm clickable


...
```

* For any element within that IonPopover (eg IonItem, IonButton, etc) any `onClick` handler will not get invoked. NOTE: However it's interesting that the click event is received by the IonPopover itself b/c setting `dismissOnSelect` does in fact dismiss the popover upon click.

```
...
function onClick (ev: React.MouseEvent) {
console.log('onPopoverItemClick From Modal!!') // <===== this is never called
}
...
```

### Expected Behavior

For any element within an IonPopover (eg IonItem, IonButton, etc) it's `onClick` handler should be invoked when clicked.

### Steps to Reproduce

Source code for demonstrating the issue: [src/pagesHome.tsx](https://github.com/jonesdhtx/ionic-test-case-1/blob/master/src/pages/Home.tsx)

To Reproduce Issue:
1. Get and run the code reproduction project from git hub using provided link
3. Click on the "Open Modal" button
4. Click on the "Trigger Popover" button
5. Click on the "I'm Clickable" button inside the popover - note the `onClick` handler is not invoked and the resulting console log is not displayed

NOTE: From the main page (outside of the modal) you can click the "Trigger Popover" button and the Button within it works as expected.

### Code Reproduction URL

https://github.com/jonesdhtx/ionic-test-case-1

### Ionic Info

Ionic:

Ionic CLI : 7.2.0
Ionic Framework : @ionic/react 7.6.4

Capacitor:

Capacitor CLI : 5.6.0
@capacitor/android : not installed
@capacitor/core : 5.6.0
@capacitor/ios : not installed

Utility:

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

System:

NodeJS : v16.14.0
npm : 8.12.1
OS : macOS Unknown

### Additional Information

_No response_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Run the linked reproduction project and inspect src/pages/Home.tsx, starting with the nested controller-created modal and inline IonPopover. Reproduce the missing onClick callback inside the popover, compare it with the working main-page case, and consider the issue done when the nested case invokes the handler while dismissOnSelect still works.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
react, typescript
領域
frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。