question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: icon click in item focuses input

See original GitHub issue

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x
  • Nightly

Current Behavior

We have an input in our app which we now want to extend by a camera scanner, so we added an icon at the iiems end to open the scanner. Clicking this icon will focus the input and show the keyboard.

This should be change-able by preventing the click event, but that doesn’t work 🤔

Expected Behavior

When using

event.preventDefault();
event.stopPropagation();

the input should not focus

Steps to Reproduce

See attached Stackblitz, just click on the camera icon

Code Reproduction URL

https://stackblitz.com/edit/ionic6-angular13-ve7khj?file=src%2Fapp%2Fapp.component.html

Ionic Info

From the app:

Ionic:

Ionic CLI : 6.20.1 (/Users/hans/.nvm/versions/node/v16.14.2/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 6.2.3 @angular-devkit/build-angular : 14.1.3 @angular-devkit/schematics : 14.1.3 @angular/cli : 14.1.3 @ionic/angular-toolkit : 7.0.0

Capacitor:

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

Cordova:

Cordova CLI : 10.0.0 (cordova-lib@10.1.0) Cordova Platforms : not available Cordova Plugins : not available

Utility:

cordova-res : 0.15.4 native-run (update available: 1.7.0) : 1.6.0

System:

Android SDK Tools : 25.2.3 (/Users/hans/Library/Android/sdk) ios-deploy : 1.10.0 NodeJS : v16.14.2 (/Users/hans/.nvm/versions/node/v16.14.2/bin/node) npm : 8.17.0 OS : macOS Monterey Xcode : Xcode 13.4.1 Build version 13F100

Additional Information

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Sep 2, 2022

I believe buttons in WebKit/Safari do not receive focus, so that could be why this behavior is happening. Once we complete the form component migration (https://github.com/ionic-team/ionic-framework/discussions/25661) I think we will likely remove the delegatesFocus feature as it was only added for form components.

edit: Also in Ionic 7 you will be able to use the input without ion-item, so this issue may be easier to work around once that change ships.

0reactions
ionitron-bot[bot]commented, Oct 2, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML input fields does not get focus when clicked
when i click it the field does not get the focus. i can access the field via pressing the "tab-key". It sounds like...
Read more >
IE focuses elements on click that should not be ... - Drupal
In IE11, any element set to display: flex; can receive focus by being clicked. This has been narrowed down to an IE bug,...
Read more >
Group Focus bug - Bubble Forum
When I make a focus group show when an icon is clicked, it will show, but then it closes automatically whenever I click...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Updated shadow DOM and dialog element focusing to the latest spec ... Fixed a bug where clicking anywhere on the progress bar pauses...
Read more >
Full Text Bug Listing - Red Hat Bugzilla
Disable ibus by left clicking its tray icon and choosing "Turn off input method." 10. Move text input focus to a text box...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found