deep-press icon indicating copy to clipboard operation
deep-press copied to clipboard

Deep press causes issues with double_tap_action and tap_action.

Open ASNNetworks opened this issue 5 years ago • 10 comments
trafficstars

Hi,

I noticed some weird behaviour with RomRiders button card since his last update. After testing extensively, we found out it's due to deep_press. This issue is also present with core button card. See this issue: https://github.com/custom-cards/button-card/issues/399

Please let me know what I can do to help :)!

ASNNetworks avatar Nov 16 '20 12:11 ASNNetworks

Sorry for not getting back to you earlier on the other thread.

I just published a small update, can you see if that works for you? I have limited time for testing right now so it might not have covered all your usecases.

roflcoopter avatar Nov 16 '20 13:11 roflcoopter

I messed up my releases a bit, 2.1.1-1 should be available now

roflcoopter avatar Nov 16 '20 14:11 roflcoopter

I tried the update (also the 2.1.1-1 after that). Didn't work unfortunately. I also deleted the component and re-installed through HACS (to make sure the latest is used) and cleared cache after that. Doesn't work also. Let me know when you have the time and pushed a new update, so I can test and get back to you :)

ASNNetworks avatar Nov 16 '20 14:11 ASNNetworks

Can you post a minimal config example so i can reproduce the error? I have a card that has both tap_action and double_tap_action defined and it works for me

roflcoopter avatar Nov 16 '20 15:11 roflcoopter

Hi, I created a short button to test this (this is core button). And I can reproduce this issue on my iPhone. I created this code below so the test is easier (so I can see the light actually turn on or not).

deep_press: true
entity: light.woonkamer_bollen
tap_action:
  action: call-service
  service: light.turn_on
  service_data:
    entity_id: light.woonkamer_bollen
double_tap_action:
  action: call-service
  service: light.turn_off
  service_data:
    entity_id: light.woonkamer_bollen
hold_action:
  action: more-info
type: button

I'm running iOS14.2 on iPhone XS Max. When I tap once on the icon, the light turns off (envoking the double_tap_action). Doing a double tap, does that twice. Single tap doesn't work, unless I remove double_tap_action or deep_press.

ASNNetworks avatar Nov 16 '20 17:11 ASNNetworks

Something seems to have changed in the way Home Assistant handles clicks and i cant figure this out im afraid. I asked RomRider for help

roflcoopter avatar Nov 19 '20 13:11 roflcoopter

I think for deep-press to work again, you'd have to catch the event while it's going down (capture) and not while it's bubbling up. {capture: true} in your eventlisteners. If you capture them while it's going down, you can do your thing and then send back the event to the child. I'm probably wrong as I'm pretty bad with events in javascript haha :)

RomRider avatar Dec 27 '20 14:12 RomRider

Is there any update on deep press working again? Just add it but seems not working on my iPhone/iPad running iOS14.3.

AndyVRD avatar Jan 23 '21 10:01 AndyVRD

No currently its not working. RomRider gave me some hints above but right now i cant find the time to look at this im afraid. Anyone is welcome to help tho with a PR

roflcoopter avatar Jan 24 '21 10:01 roflcoopter

Just released a version which fixes tap_action and hold_action to work properly. Limited testing went into this tho but it works fine for me on Windows and iPhone X.

However, double_tap_action still triggers twice and i cant for the life of me understand why.

roflcoopter avatar Jan 24 '21 12:01 roflcoopter