ionic-team / ionic-team/ionic-framework

bug: overlay returning focus to wrong element causes scroll

未关闭
#25,496 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
package: core type: bug
主要语言
TypeScript
星标
52.7k
派生
13.3k
平均合并
1 天 15 小时
30 天内合并 PR
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

- [ ] v4.x
- [ ] v5.x
- [X] v6.x
- [ ] Nightly

### Current Behavior

The scroll resets after clicking on a card.

![ion-accordion-test](https://user-images.githubusercontent.com/40690270/174295121-1491316b-35da-46ae-aca4-24270f9f0918.gif)

### Expected Behavior

The view stays in the current position.

### Steps to Reproduce

1. Install the code example
2. Scroll down
3. Click on a card

### Code Reproduction URL

https://github.com/csaar95/ion-accordion-test

### Ionic Info

Ionic:

Ionic CLI : 6.18.1 (C:\Users\Christian\AppData\Roaming\npm\node_modules\@ionic\cli)
Ionic Framework : @ionic/react 6.1.10

Capacitor:

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

Utility:

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

System:

NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 8.1.0
OS : Windows 10

### Additional Information

It cost me some time to exactly find out what causes this behaviour, it seems the bug only appears if there is an `IonCardHeader` with `IonCardTitle` inside the `IonCard`.

贡献指南

打开贡献指南

调研方向

Run the linked ion-accordion-test reproduction with Ionic React 6.1.10, then inspect the overlay focus behavior involving IonCard, IonCardHeader, and IonCardTitle. Confirm the scroll-reset scenario after clicking a card and verify that closing or returning focus leaves the view at its previous position.

由索引模型根据 Issue 内容生成。

评估

技术栈
react, typescript
领域
frontend
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。