MouseUp shooting after clicking a button in mobile Safari (iOS simulator)

I am trying to create an editing view for a mobile application running on Backbone.js and Trigger.io. The user proceeds to view notes and makes changes by clicking "edit" in the upper right corner. When the “edit” button is pressed, we focus on the text box containing the content, and the “edit” button disappears and the “Save” button appears. However, when “editing” occurs, the mouseUp event occurs, which leads to loss of focus of textarea.

The mouseUp event does not fire if the edit button is hidden and does not replace anything. The mouseUp function works if the edit button A) remains or B) is hidden, and the save button replaces it.

The only thing I found to fix this was to set a timeout of 200 ms + between hiding the "Edit" button and displaying the "Save" button.

Is there something with mouseup events that fire after click events and / or with their target individual elements? I would post the code, but it is everywhere and would not provide much context. If you really need the code, I can publish it in parts.

+4
source share
1 answer

I believe iOs puts a delay in the mouse to determine if a long touch is running. This can help:

http://cubiq.org/remove-onclick-delay-on-webkit-for-iphone

0
source

Source: https://habr.com/ru/post/1480180/


All Articles