android icon indicating copy to clipboard operation
android copied to clipboard

Android Navigation Back gesture activates buttons on dashboard

Open Tau-Neutrino opened this issue 3 years ago • 55 comments

Home Assistant Android version: 2021.10.0-full

Android version: Android 12 (SPA1A.210812.015)

Phone model: Pixel 4a

Home Assistant version: core-2021.10.6

Last working Home Assistant release (if known): all affected

Description of problem: The android back gesture seems to activate the button which is present below the trace of the finger while performing the gesture (on finger lift-off). This is not the case for other apps i tested (e.g outlook, twitter, calculator, etc), therefore it seems to be an issue with the app.

Screenshot of problem: Here is a screen record, which shows the issue (around 5 sec at the shield icon, which triggers the error message on the bottom): https://photos.app.goo.gl/BT5ZShqgiFELMuxn7

Tau-Neutrino avatar Oct 20 '21 09:10 Tau-Neutrino

I do not have this issue on my Pixel 4 XL on both android 11 and 12 do you see this issue in Chrome for Android? The apps that you mention are not webview apps so are not a fair comparison.

Also check that Android system webview and Chrome are both up to date. Disable any and all custom cards as well to see if those cause an issue.

dshokouhi avatar Oct 20 '21 14:10 dshokouhi

issue is not present in Chrome.

WebView & Chrome Version: 94.0.4606.85

Intresstingly the issue only seems to be there if I use the back gesture from the right side of the phone --> a back swipe from the left side is working as it should be. Furthermore, I also noticed that i do not actualy have to lift the finger in most cases --> just tracing over the button is activating it.

Tau-Neutrino avatar Oct 20 '21 16:10 Tau-Neutrino

What do you mean by activate? Just that the button highlights? Is it only on those button cards? What about entity card?

dshokouhi avatar Oct 20 '21 16:10 dshokouhi

Checked: Problem does not occur with entity cards. By "activate" i am referring to the activation of the "tab-action", eg a light is turned on if the tab-action of a the button is set to "toogle".

Tau-Neutrino avatar Oct 20 '21 17:10 Tau-Neutrino

Ok then yes this is definitely a frontend issue and not an app issue

dshokouhi avatar Oct 20 '21 17:10 dshokouhi

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Jan 18 '22 18:01 github-actions[bot]

This issue is present with 2021.12.10.

patriiiiiiiiiick avatar Jan 20 '22 00:01 patriiiiiiiiiick

I've noticed this as well. My phone did just update to andriod 12 recently but also home assistant did an update as well. I'm gonna roll back to last month or so and see if the problem persist. This is what happens to me. I swipe up and the button I'm on in home assistant or light whatever will turn on or off like i clicked it but also andriod will go home or back whatever gesture I did.

akusokuzan avatar Jan 26 '22 18:01 akusokuzan

I have this issue and it is quite frustrating. I've turned on the lights on sleeping roommates more than once because of it. Oops.

DuckyCrayfish avatar Mar 26 '22 07:03 DuckyCrayfish

Also having this issue on pixel 5 on Android 12. Really frustrating - hopefully can be fixed soon!

tombadog99 avatar Apr 19 '22 08:04 tombadog99

Same here, Samsung S20 , Android 12

leranp avatar May 02 '22 18:05 leranp

Any update?

leranp avatar Jun 04 '22 05:06 leranp

I've researched a bit and this seems to be relevant: https://developer.android.com/training/gestures/gesturenav

While the link to WindowInsets.getMandatorySystemGestureInsets() sounds to be relevant just for home/switch gestures, it might be a solution for back as well. Probably, we don't just want to see mandatory (=IIUC home/switch, as you can't disable it) gestures insets, but all gestures insets: https://developer.android.com/reference/android/view/WindowInsets#getSystemGestureInsets() . (I know, this is deprecated, but there is a followup.)

Once we are able to get the insets, the question is how to implement it:

a. Implement it in the companion app. This would probably mean the app would have to reduce the size of the WebView. b. Implement it in the webinterface. This would require the companion app to pass the insets to the webpage.

v6ak avatar Jun 28 '22 09:06 v6ak

@v6ak the back from the left does work as intended. Only the back gesture on the right side is problematic. It means there is an implementation in place, only partial, doesn't it?

patriiiiiiiiiick avatar Jun 28 '22 12:06 patriiiiiiiiiick

Well, this might be purely accidental. If a margin is wide enough for whatever reason, it should be OK. It seems that left margin is a bit wider than the right one. Anyway, it doesn't imply the implementation is correct – the required and actual margins might vary by device, settings etc. So, it might break on some other device, new Android version etc.

I've also seen that the safe insets are available in CSS, so there is no need to pass them from the companion app: https://developer.mozilla.org/en-US/docs/Web/CSS/env

v6ak avatar Jun 30 '22 04:06 v6ak

Still an issue in Android 13 and still really annoying.

tombadog99 avatar Aug 18 '22 13:08 tombadog99

It's even worse on Samsungs three button gestures. All gesture types trigger a click.

ArkadiuszNiemiec avatar Sep 10 '22 19:09 ArkadiuszNiemiec

@Tau-Neutrino your photos link is broken.

VNRARA avatar Dec 15 '22 23:12 VNRARA

Just want to add that I experience this consistently in Android 13 on a Google Pixel 6a. It has turned off my heat on a few occasions, which has the potential to lead to frozen and burst pipes in the winter. The two places I know for sure it has happened is on an entities card with light toggles and on a mushroom thermostat card.

jwildman16 avatar Dec 18 '22 19:12 jwildman16

Hello! We are also experiencing this bug and it's very frustrating!

bbloomberg avatar Jan 07 '23 21:01 bbloomberg

Same issue here with my Samsung Android phone. Very often, when I try to close the app with swiping up from the bottom, I accidentally turn on/off some lights or open/close blinds. Often times I don't even realize it. This is very frustrating.

This does not happen when I use Home Assistant in Chrome on my Android, just in the Home Assistant Android app.

TheYves avatar Feb 02 '23 10:02 TheYves

I can also confirm that this is an issue of the HA app. When navigating back in chrome, no HA buttons will be pressed. In the HA app I toggle buttons all the time when swiping back. Please fix :)

Igor01-Tech avatar Feb 23 '23 16:02 Igor01-Tech

This also impacts the burger side bar menu (3 lines in the top left). it should be possible to swipe diagonally from the left screen edge to open the side bar menu however this doesn't work in the HA app on Android

iDontWantAUsername avatar May 31 '23 23:05 iDontWantAUsername

Same issue here (Android 13 on Pixel 7). Very frustrating when I accidentally turn devices on and off while navigating around my dashboards!

charlie969 avatar Jun 20 '23 15:06 charlie969

This is a daily occurrence on Android 13, Samsung s22 ultra. I've had to design dashboards with double tap actions on the items near the bottom of the screen to avoid issues. Doesn't help if you have scrolled down at all.

I've also noticed picture cards (cameras) are more sensitive and almost always open.

No issues using the dash in chrome. Just HA companion app.

Jazza159 avatar Jul 14 '23 12:07 Jazza159

Meanwhile changed phone to pixel 7, Android 13 lates version. Same issue still present. The HA app is nearly unusable with Android gestures in my opinion....

Tau-Neutrino avatar Jul 22 '23 14:07 Tau-Neutrino

This also impacts the burger side bar menu (3 lines in the top left). it should be possible to swipe diagonally from the left screen edge to open the side bar menu however this doesn't work in the HA app on Android

This swipe to open menu has been disabled thankfully as it was getting interfered by the back gesture causing the whole menu to be stuck one pixel out. Even if swiping diagonally is a bit different it's to precise of an action to put in the app imo.

It's been two years since this was reported. Ffs It's really annoying when things don't get done right in the first place. HA is the only app I know that has this issue:

https://github.com/home-assistant/android/assets/3942672/780bee18-2e56-45a2-b83d-0d722cd8de04

VNRARA avatar Aug 13 '23 08:08 VNRARA

After some experimentations with the app source, I think that this issue is caused by the fact that the back gesture, as soon as it started by the user, causes a touchstart event on the cards, which toggles the card state. This odd behavior looks like a WebView/Android bug to me, so I don't think that the HA app developers can do much about it.

A quick but ugly workaround that I'm currently using is to add a margin to the dashboard content, with a value that is sufficient to have the cards not placed in the edge areas of the screen where the back gesture happens. For example (last line):

title: Home
views:
  - theme: Backend-selected
    path: default_view
    title: Home
    icon: mdi:home-assistant
    type: custom:grid-layout
    subview: false
    layout:
      grid-template-columns: repeat(auto-fit, minmax(250px, 1fr))
      grid-template-rows: auto
      margin: 0px 40px

venator85 avatar Aug 27 '23 15:08 venator85

After some experimentations with the app source, I think that this issue is caused by the fact that the back gesture, as soon as it started by the user, causes a touchstart event on the cards, which toggles the card state. This odd behavior looks like a WebView/Android bug to me, so I don't think that the HA app developers can do much about it.

So I opened my instance via reddit which opens a webview tap. Tried the bug. Didn't occur. Is this not the same webview?

VNRARA avatar Aug 27 '23 22:08 VNRARA

Conversely if this is an Android/WebView defect could someone with knowledge with how to replicate log a defect in the Android project https://issuetracker.google.com/issues and link back to this ticket?

iDontWantAUsername avatar Aug 27 '23 23:08 iDontWantAUsername