mw.action.edit: Restore modifier keys for accesskey in tooltip for summary field
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 19 Jun 2017 19:50:59 +0000 (21:50 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Mon, 19 Jun 2017 20:09:16 +0000 (20:09 +0000)
.updateTooltipAccessKeys() is called automatically after the page
loads (from mediawiki.page.ready), but infusing the field blows away
these changes.

This is a poor workaround, the same issue will appear if e.g. the
buttons are infused. The functionality provided by jquery.accessKeyLabel
should be an OOjs UI feature, or we should somehow call it automatically
after infusing widgets.

Bug: T168042
Change-Id: I2b166be34b8394c296fbc7326570cd732284888f

resources/Resources.php
resources/src/mediawiki.action/mediawiki.action.edit.js

index f4149ea..864f93e 100644 (file)
@@ -1415,6 +1415,7 @@ return [
                'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.css',
                'dependencies' => [
                        'mediawiki.action.edit.styles',
+                       'jquery.accessKeyLabel',
                        'jquery.textSelection',
                        'jquery.byteLimit',
                        'mediawiki.api',
index 49e64b5..8cde703 100644 (file)
                        mw.loader.using( 'oojs-ui-core' ).then( function () {
                                var wpSummary = OO.ui.infuse( $( '#wpSummaryWidget' ) );
 
+                               // Restore appropriate modifier keys for the accesskey in the 'title' attribute
+                               // TODO: This should be an OOjs UI feature, or somehow happen automatically after infusing.
+                               wpSummary.$input.updateTooltipAccessKeys();
+
                                // Make sure edit summary does not exceed byte limit
                                wpSummary.$input.byteLimit( 255 );