bramkragten / swipe-card

Card that allows you to swipe throught multiple cards for Home Assistant Lovelace
245 stars 36 forks source link

Hold action not executed #35

Open Mariusthvdb opened 3 years ago

Mariusthvdb commented 3 years ago

using:

type: custom:button-card
template: button_body
entity: binary_sensor.ha_update_available
icon: mdi:home-assistant
name: Core update
show_state: false
tap_action:
  action: more-info
  entity: sensor.ha_available_version
hold_action:
  action: url
  url_path: https://github.com/home-assistant/core/releases

url hold_action on this button-card works perfectly. However when this card is displayed in the swiper, it (almost) always performs/shows the tap_action more-info, if anything. Funny thing is, when I go to a view where this same card is always shown, the url works fine, and then going back to the swiper, makes it work....

Its not a matter of clicking on the right spot, the handle turns in to the correct pointing hand (and the 'hold' circle doesnt show either)

as I was just made aware in the community this is only on Desktop. Mobile works alright.

see what ASNNetworks writes on the matter:

If you have a slider inside a swiper card, then it’s a little more complicated. Then you need to hold right click first and then hold left click (without letting right click off) and drag with both fingers. This means you need a mouse with both buttons (so Apple magic mouse is not usable for instance). But perhaps you can also use macro’s of function key for that.

ASNNetworks commented 3 years ago

I experienced this same issue a few months ago when I started to use swiper card. I have found a way to invoke hold action by accident on browsers. This works 100 of the time and I’ve been doing it this way for months now.

Press and hold right click on an icon till you see the hold_action effect (the little circle effect). Then let go and single press left click. All buttons inside that swiper card will open hold_action now with left click. To stop, just single press right click and then left click works as toggle again.

If you have a slider inside a swiper card, then it’s a little more complicated. Then you need to hold right click first and then hold left click (without letting right click off) and drag with both fingers. This means you need a mouse with both buttons (so Apple magic mouse is not usable for instance). But perhaps you can also use macro’s of function key for that.

Other users noticed this as well and one reported this:

I found an interesting thing. From chrome in dev tools, with the toggle device toolbar, we can use properly hold and click actions
Question : Is it possible to force applicationize.me 2 to work in with the “toggle device toolbar” and emulate a tablet ? (User agent ?)

Mattias noticed this with glace card as well. So I think it applies to all cards inside swiper-card, See ticket https://github.com/bramkragten/swipe-card/issues/7

Mariusthvdb commented 3 years ago

to add: the 'funny' experience from my opening post can now be explained some more:

right hold clicking the button in the slider apparently toggles the action (if it was hold, it changes to tap and vv). So I can right click hold, see the hold circle show (still in the slider) and next tap, to perform the original hold. It navigates to the other view. repeating that sequence sets it back to tap action, etc etc. How odd.

tried simulateTouch because on the touch iPhone this all works as expected, but that doesnt help in current Desktop.

ASNNetworks commented 3 years ago

Yes, you can also right click the button card again (single tap), which will revert it back to normal and left click will then register as tap_action again.

ethank commented 2 years ago

Assuming this is a "never will be fixed" issue?

esbenr commented 2 years ago

This is a problem with both hold and double click action. The swipe-card doesn't allow it. This should be fixed. The workaround with right clicking is not a solution as it doesn't work on tablets/touch screens.

ASNNetworks commented 2 years ago

This is a problem with both hold and double click action. The swipe-card doesn't allow it. This should be fixed. The workaround with right clicking is not a solution as it doesn't work on tablets/touch screens.

This issue is not present on tablets/touchscreens. Only desktop browsers are affected, which makes the workaround usable for most people. Majority uses smartphones/tablets, which has no issues with hold actions.

EuleMitKeule commented 2 years ago

+1 on this. The proposed workaround is working, but way too unintuitive. Unfortunately this great card is not really usable for me in this state.