Skip to content

fix(alert): remove focus outline from wrapper - #31684

Open
ShryukGrandhi wants to merge 1 commit into
ionic-team:mainfrom
ShryukGrandhi:fix/issue-31679-bug-ion-alert-draws-the-browser-s-focus
Open

ShryukGrandhi wants to merge 1 commit into
ionic-team:mainfrom
ShryukGrandhi:fix/issue-31679-bug-ion-alert-draws-the-browser-s-focus

Conversation

@ShryukGrandhi

Copy link
Copy Markdown

Issue number: resolves #31679


What is the current behavior?

When an alert has inputs or more than one button, present() moves focus to .alert-wrapper (which has tabindex="0"). alert.scss removes the outline from the host, the buttons and the inputs, but not from the wrapper. On iOS Safari the wrapper matches :focus-visible after a tap, so the browser's default focus ring is drawn around the whole dialog.

What is the new behavior?

  • Set outline: none on .alert-wrapper, the same way it's already set on the host, buttons and inputs.
  • Added an e2e test in alert/test/basic that focuses the wrapper from the keyboard (so it matches :focus-visible) and checks that its computed outline-style is none.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Before the fix, the new test failed with outline-style of auto. After the fix it passes in Mobile Chrome, Mobile Firefox and Mobile Safari (WebKit), for both ios and md modes. The existing focus trap test still passes.

Fixes #31679

Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
@ShryukGrandhi
ShryukGrandhi requested a review from a team as a code owner November 3, 2026 00:51
@ShryukGrandhi
ShryukGrandhi requested a review from ShaneK November 3, 2026 00:51
@vercel

vercel Bot commented Nov 3, 2026

Copy link
Copy Markdown

@ShryukGrandhi is attempting to deploy a commit to the Ionic Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the package: core @ionic/core package label Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant