Skip to content

bug: Programmatically focus an ion-button #21439

@AE1NS

Description

@AE1NS

Bug Report

Ionic version:
[x] 4.x

Current behavior:
There is no .setFocus() Method on an ion-button element. The only method I found that could focus the element, was IONELEMENT.el.focus(). Unfortunately this method does not focus the button (checked with document.activeElement). Its a huge problem when trying to build an accessible app.

Expected behavior:
Either a .setFocus() method (like on an ion-input) or a .focus() method on the 'el' property, that focus the button correctly.

Steps to reproduce:
Access the button in TS Code and call the .focus() method on the 'el' property.

Related code:

@ViewChild(IonButton) button;
...
this.button.el.focus();

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions