Santhosh has uploaded a new change for review.

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

Change subject: Don't swap link cards when opening the link of the card behind
......................................................................

Don't swap link cards when opening the link of the card behind

Link cards are presented usually in pairs. Although the card in front
represents the main action (add/remove link in the translation),
it is possible to explore the card behind by either hovering
(the card behind is temporary revealed allowing to click on the link
to open it) or clicking on the card (cards switch positions).
The problem is that when the link from the card behind it is opened,
the click event propagates to the whole card and the cards are also swapped.
Cards should be only swapped when clicking on the card behind except when 
clicking on the link.

Bug: T106595
Change-Id: I0873eb77b082c06004718a6e7b737d1a9fa97062
---
M modules/tools/ext.cx.tools.link.js
1 file changed, 5 insertions(+), 2 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/ContentTranslation 
refs/changes/78/227178/1

diff --git a/modules/tools/ext.cx.tools.link.js 
b/modules/tools/ext.cx.tools.link.js
index edcaa43..35152b6 100644
--- a/modules/tools/ext.cx.tools.link.js
+++ b/modules/tools/ext.cx.tools.link.js
@@ -797,8 +797,11 @@
                var self = this;
 
                // Bring the card to front when clicked
-               this.$card.on( 'click', '.card:first', function () {
-                       $( this ).insertAfter( self.$card.find( '.card:last' ) 
);
+               this.$card.on( 'click', '.card:first', function ( e ) {
+                       if ( !$( e.target ).is( 'a' ) ) {
+                               // We should not swap the cards when click was 
on the link in the card.
+                               $( this ).insertAfter( self.$card.find( 
'.card:last' ) );
+                       }
                } );
        };
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0873eb77b082c06004718a6e7b737d1a9fa97062
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/ContentTranslation
Gerrit-Branch: master
Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com>

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

Reply via email to