Esanders has uploaded a new change for review.
https://gerrit.wikimedia.org/r/241699
Change subject: [WIP] mediawiki.widgets: Don't apply href to TitleOptionWidget
link
......................................................................
[WIP] mediawiki.widgets: Don't apply href to TitleOptionWidget link
The click action on TitleOptionWidgets is to select them, not
to open the link. Currently users can middle click, or right click
these links to get them to open, although this behaviour is
magical and not discoverable. It is also ugly that the links take
underline decoration when hovered, but do not behave as normal
links.
TODO: Decide if this is acceptable, or if we need to provide
an alternative that is better than selecting the link and
clicking 'Open'.
Change-Id: Id886940a9c733c237e5ce08a9f189aa48ade2c99
---
M resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js
M resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
M resources/src/mediawiki.widgets/mw.widgets.TitleWidget.less
3 files changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/99/241699/1
diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js
b/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js
index 138715a..43f1900 100644
--- a/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js
+++ b/resources/src/mediawiki.widgets/mw.widgets.TitleOptionWidget.js
@@ -15,7 +15,6 @@
* @constructor
* @param {Object} config Configuration options
* @cfg {string} data Label to display
- * @cfg {string} url URL of page
* @cfg {string} [imageUrl] Thumbnail image URL with URL encoding
* @cfg {string} [description] Page description
* @cfg {boolean} [missing] Page doesn't exist
@@ -41,14 +40,13 @@
icon: icon,
label: config.data,
autoFitLabel: false,
- $label: $( '<a>' )
+ $label: $( '<a href="#">' )
}, config );
// Parent constructor
mw.widgets.TitleOptionWidget.parent.call( this, config );
// Initialization
- this.$label.attr( 'href', config.url );
this.$element.addClass( 'mw-widget-titleOptionWidget' );
// Highlight matching parts of link suggestion
@@ -71,6 +69,11 @@
.text( config.description )
);
}
+
+ // Events
+ this.$label.on( 'click', function () {
+ return false;
+ } );
};
/* Setup */
diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
index 672b54a..bc6f04c 100644
--- a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
+++ b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.js
@@ -250,7 +250,6 @@
data: this.namespace !== null && this.relative
? mwTitle.getRelativeText( this.namespace )
: title,
- url: mwTitle.getUrl(),
imageUrl: this.showImages ? data.imageUrl : null,
description: this.showDescriptions ? data.description :
null,
missing: data.missing,
diff --git a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.less
b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.less
index ecd0824..cea8798 100644
--- a/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.less
+++ b/resources/src/mediawiki.widgets/mw.widgets.TitleWidget.less
@@ -12,6 +12,10 @@
&-description {
color: #888;
}
+
+ > .oo-ui-labelElement-label {
+ pointer-events: none;
+ }
}
&-menu-withImages {
--
To view, visit https://gerrit.wikimedia.org/r/241699
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id886940a9c733c237e5ce08a9f189aa48ade2c99
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Esanders <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits