Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditableViewer cannot be clicked on mobile #720

Closed
alexconstantin opened this issue Aug 11, 2022 · 5 comments
Closed

EditableViewer cannot be clicked on mobile #720

alexconstantin opened this issue Aug 11, 2022 · 5 comments
Labels
bug Something isn't working complete
Milestone

Comments

@alexconstantin
Copy link

alexconstantin commented Aug 11, 2022

Environments

Description

Clicking the + / - buttons works on desktop, but on mobile it has no effect.
This functionality was working in previous versions of Moveable.

@daybrush daybrush added the bug Something isn't working label Aug 11, 2022
@daybrush
Copy link
Owner

@alexconstantin
I'll fix it soon.

@daybrush daybrush added this to the 0.35.1 milestone Aug 12, 2022
daybrush added a commit that referenced this issue Aug 12, 2022
@daybrush
Copy link
Owner

@alexconstantin

  • lit-moveable 0.12.1
  • moveable 0.35.1
  • preact-moveable 0.37.1
  • react-compat-moveable 0.23.1
  • react-moveable 0.38.1
  • svelte-moveable 0.27.1
  • vue-moveable 2.0.0-beta.33
  • vue3-moveable 0.10.1
  • ngx-moveable 0.32.1

moveable's new version is released. Check it again.

@alexconstantin
Copy link
Author

@daybrush Thank you! The button is now clickable again on mobile. However I found another scenario. Please check this link: https://codesandbox.io/s/gracious-wu-0ri1kz?file=/src/App.tsx

On the top of the page there is a button. Clicking it will alert the value "1". I've changed a bit the functionality for the +/ - buttons so that they will trigger a click event (using jQuery) on that button. However, nothing happens, both on desktop and mobile. Is the propagation of the click event stopped somehow? Is there a way to trigger click events in this scenario?

@daybrush
Copy link
Owner

daybrush commented Aug 12, 2022

@alexconstantin

In Moveable, stopPropagationd is applied to the click event.

And click event in react is SyntheticEvent.
A problem may occur due to the difference in the order of react events and native events.

The following method is recommended.

const onButtonClick = () => {
      console.log(jQuery("#test"));
      requestAnimationFrame(() => {
        jQuery("#test").trigger("click");
      });
};

@alexconstantin
Copy link
Author

@daybrush Thank you! It works now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working complete
Projects
None yet
Development

No branches or pull requests

2 participants