ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
51.09k stars 13.51k forks source link

bug: ion-button stays highlighted/selected when clicked #23665

Closed mobilemarines closed 3 years ago

mobilemarines commented 3 years ago

Prequisites

Ionic Framework Version

Current Behavior

On an android device(tested on Android 9 so far), after clicking the ion-button, it stays highlighted. The effect seems to be the same like when hovering in the browser. Can´t really tell, as when inspecting the webview on the device, as soon as I select the ion-button in the dom, the effect disappears. So unforutnatelly I can´t see which classes are still applied on the button. Was able to reproduce the issue with a blank template and only added an ion-button like below. Didn´t change any stylings. The same issue also happened with ion-buttons in modals.

Expected Behavior

The button should be highlighted for a moment as a user feedback, but then switch back to the default color.

Steps to Reproduce

`<ion-header [translucent]="true">

Test Test

`

Code Reproduction URL

https://github.com/mobilemarines/ionButtonTest/tree/master

Ionic Info

Ionic:

Ionic CLI : 5.4.4 (C:\Users\vogt\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 5.6.11 @angular-devkit/build-angular : 12.1.2 @angular-devkit/schematics : 12.1.2 @angular/cli : 12.1.2 @ionic/angular-toolkit : 4.0.0

Utility:

cordova-res : 0.15.3 native-run : 1.4.0

System:

NodeJS : v12.18.2 (C:\Program Files\nodejs\node.exe) npm : 6.14.5 OS : Windows 10

Additional Information

{ "name": "ionic-app-base", "version": "0.0.0", "author": "Ionic Framework", "homepage": "https://ionicframework.com/", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/common": "~12.1.1", "@angular/compiler": "~12.1.1", "@angular/core": "~12.1.1", "@angular/forms": "~12.1.1", "@angular/platform-browser": "~12.1.1", "@angular/platform-browser-dynamic": "~12.1.1", "@angular/router": "~12.1.1", "@capacitor/android": "^3.1.1", "@capacitor/core": "3.1.1", "@ionic/angular": "^5.5.2", "rxjs": "~6.6.0", "tslib": "^2.2.0", "zone.js": "~0.11.4" }, "devDependencies": { "@angular-devkit/build-angular": "~12.1.1", "@angular-eslint/builder": "~12.0.0", "@angular-eslint/eslint-plugin": "~12.0.0", "@angular-eslint/eslint-plugin-template": "~12.0.0", "@angular-eslint/template-parser": "~12.0.0", "@angular/cli": "~12.1.1", "@angular/compiler": "~12.1.1", "@angular/compiler-cli": "~12.1.1", "@angular/language-service": "~12.0.1", "@capacitor/cli": "3.1.1", "@ionic/angular-toolkit": "^4.0.0", "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", "@typescript-eslint/eslint-plugin": "4.16.1", "@typescript-eslint/parser": "4.16.1", "eslint": "^7.6.0", "eslint-plugin-import": "2.22.1", "eslint-plugin-jsdoc": "30.7.6", "eslint-plugin-prefer-arrow": "1.2.2", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.2", "karma-chrome-launcher": "~3.1.0", "karma-coverage": "~2.0.3", "karma-coverage-istanbul-reporter": "~3.0.2", "karma-jasmine": "~4.0.0", "karma-jasmine-html-reporter": "^1.5.0", "protractor": "~7.0.0", "ts-node": "~8.3.0", "typescript": "~4.2.4" } }

ionitron-bot[bot] commented 3 years ago

Thanks for the issue! This issue has been labeled as needs reproduction. This label is added to issues that need a code reproduction.

Please reproduce this issue in an Ionic starter application and provide a way for us to access it (GitHub repo, StackBlitz, etc). Without a reliable code reproduction, it is unlikely we will be able to resolve the issue, leading to it being closed.

If you have already provided a code snippet and are seeing this message, it is likely that the code snippet was not enough for our team to reproduce the issue.

For a guide on how to create a good reproduction, see our Contributing Guide.

mobilemarines commented 3 years ago

@liamdebeasi Added a github repo that reproduces the issue. Tanks for the fast response. Best regards

liamdebeasi commented 3 years ago

Thanks for the follow up. What version of the webview are you testing this on? You can find this out by logging window.navigator.userAgent to the console when inspecting the app.

mobilemarines commented 3 years ago

I tested this on 2 devices up to now. One has the Chrome 92.0.4515.115 and the other device uses the Android System WebView 91.0.4472.164.

liamdebeasi commented 3 years ago

Thanks! I tested this on my Android device and was unable to reproduce the issue. Can you clarify the steps to reproduce?

https://user-images.githubusercontent.com/2721089/127176283-2a93004e-dd4d-4278-8591-25b7702654d4.mp4

mobilemarines commented 3 years ago

Oh I see. We build an app with ionic and capacitor. Our build steps are in the readme.md. So I guess there must be something mixed up after the android build.

mobilemarines commented 3 years ago

Wanted to cancel a comment and accidently closed the issue. I´ll change the background to a darker blue qickly, so you can see the difference better on screenshots.

liamdebeasi commented 3 years ago

Let me check in Capacitor real quick. Maybe there is a difference between browser and webview.

mobilemarines commented 3 years ago

Alright. Thanks for you help.

liamdebeasi commented 3 years ago

Here is the app running in Capacitor and it seems to be working fine:

https://user-images.githubusercontent.com/2721089/127182701-71ee046b-b2b1-4ba1-9754-fc9391947751.mp4

I am running Chrome 92.0.4515.115. What devices have you tested this on? I am testing on a Pixel 4a.

mobilemarines commented 3 years ago

My devices are a Xiaomi Mi A1 and a Xiaomi POCO X3 NFC. If you touch hold that button, you can see the button background will get slightly brighter. This effect stays there for me until I touch somewhere else on the screen. Even when I just click the button the brightend up button will stay like this. I´ll attach screenshots. One moment.

mobilemarines commented 3 years ago

ion_button_brighter ion_button_dark

liamdebeasi commented 3 years ago

It might be an issue with how the device dispatches touch events. Do you have any other Android devices you can test on?

mobilemarines commented 3 years ago

Unfortunately not. I haven´t been able to reproduce this issue in the emulators. I will reach out to my colleagues tomorrow and will get back to you when I got more info or examples. Appreciate your help and your quick responses! Thanks!

mobilemarines commented 3 years ago

Hi Liam. My colleague also has a Pixel, but as I wasn´t able to reproduce this in the emulator I guess it´s a manufacturer specific issue. Thanks for you help.

liamdebeasi commented 3 years ago

Thanks for the follow up. You might want to consider opening an issue on the Chromium bug tracker: https://bugs.chromium.org/p/chromium/issues/list

Chromium is the engine that powers Google Chrome, so there may be a bug in Chromium that only reproduces on the types of device you are using.

I am going to close this for now since I am unable to reproduce the issue, but if you have additional info that lets us reproduce the issue on other devices feel free to follow up and I can take another look. Thanks!

ionitron-bot[bot] commented 3 years ago

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.