Skip to content

fix(overlays): do not blur focused element on present when keyboardClose is false - #31644

Open
ShryukGrandhi wants to merge 1 commit into
ionic-team:mainfrom
ShryukGrandhi:fix/issue-31199-bug-ionpopover-keyboardclose-false-does
Open

ShryukGrandhi wants to merge 1 commit into
ionic-team:mainfrom
ShryukGrandhi:fix/issue-31199-bug-ionpopover-keyboardclose-false-does

Conversation

@ShryukGrandhi

Copy link
Copy Markdown

Issue number: resolves #31199


What is the current behavior?

When an overlay is presented, restoreElementFocus blurs the currently focused element unconditionally, before keyboardClose is checked anywhere. So an ion-popover with keyboard-close="false" opened while a text input is focused still takes focus away from the input, and on mobile the keyboard closes. This started in 8.7.4 when the blur was added to prevent an a11y warning.

What is the new behavior?

  • restoreElementFocus only blurs the previously focused element when the overlay's keyboardClose is not false. The element is still remembered so focus is restored on dismiss.
  • Default behavior (keyboardClose true) is unchanged.
  • Added spec tests for ion-popover checking that the focused input is not blurred on present with keyboardClose={false} and still is with keyboardClose={true}.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Fixes #31199

Tested with npx stencil test --spec in core (new test fails before the change, all 812 spec tests pass after), plus eslint and prettier on the touched files.

…ose is false

Signed-off-by: ShryukGrandhi <85529990+ShryukGrandhi@users.noreply.github.com>
@ShryukGrandhi
ShryukGrandhi requested a review from a team as a code owner October 23, 2026 21:29
@ShryukGrandhi
ShryukGrandhi requested a review from ShaneK October 23, 2026 21:29
@vercel

vercel Bot commented Oct 23, 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 Oct 23, 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: IonPopover keyboardClose={false} does not prevent keyboard dismissal since ionic 8.7.4

1 participant