ionic-team / ionic-team/ionic-framework

bug: firefox, focus event does not fire when delegating focus

Open
#25,070 5 comments 0 reactions 0 assignees View on GitHub
bug: external type: bug
Dominant language
TypeScript
Stars
52.7k
Forks
13.3k
Avg merge
1d 14h
Merged PRs (30d)
50

Description

### Prerequisites

- [X] I have read the [Contributing Guidelines](https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#creating-an-issue).
- [X] I agree to follow the [Code of Conduct](https://ionicframework.com/code-of-conduct).
- [X] I have searched for [existing issues](https://github.com/ionic-team/ionic-framework/issues) that already report this problem, without success.

### Ionic Framework Version

- [ ] v4.x
- [ ] v5.x
- [X] v6.x

### Current Behavior

When the user clicks on an `` the focus is delegated to the first focusable element, in my case an ``. In this matter I was expecting the `` to fire with it's respective `(ionFocus)` event, which is unfortunatley not the case. I also tried to add a native `(focus)` event listener, which also does not seem to get triggered.

### Expected Behavior

When the user clicks on an `` the focus should get delegated to the ``, which should then fire an `(ionFocus)` event.

### Steps to Reproduce

See Stackblitz minimal reproduction code below.

### Code Reproduction URL

https://stackblitz.com/edit/ionic6-angular13-gqcrhl?file=src/app/app.component.html

### Ionic Info

```
Ionic:

Ionic CLI : 6.16.3 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 6.0.14
@angular-devkit/build-angular : 13.3.1
@angular-devkit/schematics : 13.3.1
@angular/cli : 13.3.1
@ionic/angular-toolkit : 6.1.0

Capacitor:

Capacitor CLI : 3.4.3
@capacitor/android : 3.4.3
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.3

Utility:

cordova-res : not installed globally
native-run : 1.5.0

System:

NodeJS : v14.17.6 (/Users/felixgeissler/.nvm/versions/node/v14.17.6/bin/node)
npm : 6.14.15
OS : macOS Monterey
```

### Additional Information

In my case, this is a real show stopper since I'm trying to use my `` as a focus trigger to open an `` in a popover and I don't want the user to enter something in the input manually. With this approach I need a hook to open the popover once the focus is delegated to the ``.

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and inspect how ion-item delegates focus to ion-input in Firefox. Verify whether the delegated element emits the native focus and ionFocus events, then confirm the fix against the reproduction and expected focus behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.