Saltymule has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/195060

Change subject: Don't invoke native bridge if there is selected text
......................................................................

Don't invoke native bridge if there is selected text

If there is selected text the user is involved with a process that our native 
code is largely not
invloved in. The property "rangeCount" indicates the number of ranges that are 
selected. If there
is at least one (the only number that can be selected with human interface on 
the iphone) then we
know that there is selected text, and the user should complete the flow 
involved with the selected
text before our native code reacts to touch interactions.

The alternative to this was to pass the rangeCount as a parameter to the native 
code, but this
would have required an increase of the interface between the javascipt and 
native code, which
should probably stay as simple as possible.

From a usability standpoint this means that if there is selected text, then a 
user will first need
to tap to deselect the text, then tap to show the menu again. As a user I 
believe this is a
predictable interaction and should be fine.

Bug: T91605
Change-Id: I63640ef374034b093b6dafedf8b5c3e35d4a04c3
---
M www/js/listeners.js
1 file changed, 4 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/ios/wikipedia 
refs/changes/60/195060/1

diff --git a/www/js/listeners.js b/www/js/listeners.js
index 0b641c7..2ef25eb 100644
--- a/www/js/listeners.js
+++ b/www/js/listeners.js
@@ -138,7 +138,10 @@
      specify the event's target instead
      */
     var didSendMessage = maybeSendMessageForTarget(event, 
findParent(event.target, 'A') || event.target);
-    if (!didSendMessage) {
+
+    var hasSelectedText = window.getSelection().rangeCount > 0;
+ 
+    if (!didSendMessage && !hasSelectedText) {
         // Do NOT prevent default behavior -- this is needed to for instance
         // handle deselection of text.
         bridge.sendMessage('nonAnchorTouchEndedWithoutDragging', {

-- 
To view, visit https://gerrit.wikimedia.org/r/195060
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I63640ef374034b093b6dafedf8b5c3e35d4a04c3
Gerrit-PatchSet: 1
Gerrit-Project: apps/ios/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Saltymule <danielmuel...@uwalumni.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to