bug: ion-alert draws the browser's focus ring around the whole dialog after a tap on iOS

Đang mở
#31,679 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
css, html, ios, typescript
Lĩnh vực
frontend, mobile

Hướng nghiên cứu

The focus call is in present() in alert.tsx, where .alert-wrapper (tabindex 0) is focused, and the styling is in alert.scss, which zeroes outline on the host, buttons and inputs but not the wrapper. Reproduce with the linked gist on iOS Safari and check :focus-visible and outline-style on the wrapper after present(). Done when the wrapper draws no focus ring after a tap, while keyboard focus still works. A pull request (#31684) is already open against this, so check it before starting.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

package: core type: bug
Ionic version

@ionic/core 9.0.9. The same code is on main (alert.tsx, alert.scss).

Current behavior

On iOS, tapping a button that presents an ion-alert with inputs or more than one button draws a blue ring around the whole dialog.

present() calls wrapperEl.focus() on .alert-wrapper, which has tabindex="0". alert.scss sets outline: none on the host, the buttons and the inputs, but not on the wrapper. After the tap the wrapper matches :focus-visible, so the browser's default focus ring is drawn on it.

Measured on the wrapper in Safari on an iOS 26.5 simulator (iPhone 17 Pro), right after present():

{ "focused": true, "focusVisible": true, "outlineStyle": "auto" }

We first saw it on a physical iPhone in a Capacitor app. With a mouse click in desktop WebKit (Playwright) the wrapper does not match :focus-visible and no ring is drawn.

Expected behavior

Tapping a button that presents an alert does not draw a focus ring around the whole dialog.

Steps to reproduce
  1. Open the reproduction in Safari on iOS (a simulator is enough).
  2. Tap Open alert.

The blue ring appears around the dialog, and the page prints the values above.

Code reproduction

A single HTML file on stock Ionic 9.0.9 from the CDN: https://gist.github.com/tzdevelopteam/16bfbe6ea1e933886b3c596461fa94a8

Ngôn ngữ chính
TypeScript
Star
52.8k
Fork
13.3k
Merge trung bình
3 ngày 1 giờ
Pull request đã merge (30 ngày)
86

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ionic-team/ionic-framework

Tất cả issue của ionic-team/ionic-framework

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.