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

オープン
#31,679 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
css, html, ios, typescript
領域
frontend, mobile

調査の方向性

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.

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

説明

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

主要言語
TypeScript
スター
52.8k
フォーク
13.3k
平均マージ
3日 1時間
マージ済み PR(30日)
86

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ionic-team/ionic-framework のほかの issue

ionic-team/ionic-framework の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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