Catrope has uploaded a new change for review.

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

Change subject: Follow-up 07c5850b: unbreak "mark as read" menu item
......................................................................

Follow-up 07c5850b: unbreak "mark as read" menu item

07c5850b changed the widget used for the "mark as read"
menu item from OO.ui.ButtonOptionWidget to mw.echo.ui.MenuItemWidget.
While this makes sense, it also broke its functionality, because
mw.echo.ui.MenuItemWidgets are unselectable so if you click them
the 'choose' event isn't emitted.

However, we also can't make these widgets selectable, because
that breaks the links inside these widgets (the containing MenuSelectWidget
intercepts mouse events and prevents default). So instead,
make mw.echo.ui.MenuItemWidgets only be unselectable if they are
links (have config.url set), so that both use cases work.

Bug: T128432
Change-Id: I8374e3ae61a005ec7d25c2eb95b1391cbb191d60
---
M modules/ooui/mw.echo.ui.MenuItemWidget.js
1 file changed, 8 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo 
refs/changes/49/274049/1

diff --git a/modules/ooui/mw.echo.ui.MenuItemWidget.js 
b/modules/ooui/mw.echo.ui.MenuItemWidget.js
index 75eee95..8fccce7 100644
--- a/modules/ooui/mw.echo.ui.MenuItemWidget.js
+++ b/modules/ooui/mw.echo.ui.MenuItemWidget.js
@@ -47,6 +47,7 @@
                        );
 
                if ( config.url ) {
+                       this.hasLink = true;
                        this.$element.contents()
                                .wrapAll(
                                        // HACK: Wrap the entire item with a 
link that takes
@@ -69,9 +70,15 @@
 
        /* Static Properties */
 
-       mw.echo.ui.MenuItemWidget.static.selectable = false;
        mw.echo.ui.MenuItemWidget.static.highlightable = false;
        mw.echo.ui.MenuItemWidget.static.pressable = false;
 
+       /* Methods */
+
+       mw.echo.ui.MenuItemWidget.prototype.isSelectable = function () {
+               // If we have a link, force selectability to false, otherwise 
defer to parent method
+               return !this.hasLink && 
mw.echo.ui.MenuItemWidget.parent.prototype.isSelectable.apply( this, arguments 
);
+       };
+
 } )( mediaWiki, jQuery );
 

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I8374e3ae61a005ec7d25c2eb95b1391cbb191d60
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Catrope <roan.katt...@gmail.com>

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

Reply via email to