MediaWiki:Gadget-GrAnnotations.js: Difference between revisions

No edit summary
No edit summary
Line 656: Line 656:
     });
     });


     /* ── Mobile: selectionchange debounced 700ms ──
     /* ── Mobile: touchend triggers selection check ──
     * We snapshot _selRange inside captureSelection() at this point,
     * On Minerva, selectionchange fires during drag but the range
     * so it's safely stored before the user taps the action button
     * isn't stable until touchend. We listen for touchend too and
     * (which would clear window.getSelection()).                      */
     * check after a short delay for the selection to settle.        */
    document.addEventListener('touchend', function() {
      if (!_mobile) return;
      clearTimeout(_selTimer);
      _selTimer = setTimeout(tryShowActions, 400);
    }, { passive: true });
 
    /* ── selectionchange debounced 600ms ── */
     var _selTimer = null;
     var _selTimer = null;
     document.addEventListener('selectionchange', function() {
     document.addEventListener('selectionchange', function() {
Line 669: Line 676:
         if (_fabSelVer === v) return;
         if (_fabSelVer === v) return;
         tryShowActions();
         tryShowActions();
       }, 700);
       }, 600);
     });
     });