Change save dialog accesskey to be entirely off the trigger

Accesskeys in this situation are unreliable cross-browser. Firefox won't
trigger the accesskey inside the dialog. We can manually simulate it, via the
existing trigger.

Bug: T121183
Change-Id: Ib919d8b9fcd9324a517037bcc6ef93a26d1488b9
This commit is contained in:
David Lynch 2018-01-08 11:52:06 -06:00
parent 767865c8ed
commit a89c79dc79
2 changed files with 13 additions and 13 deletions

View file

@ -1926,13 +1926,23 @@ ve.init.mw.ArticleTarget.prototype.onToolbarSaveButtonClick = function () {
* @fires saveWorkflowBegin
*/
ve.init.mw.ArticleTarget.prototype.showSaveDialog = function ( action, checkboxName ) {
var checkbox,
var checkbox, currentWindow,
target = this;
if ( !( this.edited || this.restoring ) ) {
return;
}
currentWindow = this.getSurface().getDialogs().getCurrentWindow();
if ( currentWindow && currentWindow.constructor.static.name === 'mwSave' && ( action === 'save' || action === null ) ) {
// The current window is the save dialog, and we've gotten here via
// the save action. Trigger a save. We're doing this here instead of
// relying on an accesskey on the save button, because that has some
// cross-browser issues that makes it not work in Firefox.
currentWindow.executeAction( 'save' );
return;
}
this.emit( 'saveWorkflowBegin' );
// Preload the serialization

View file

@ -58,8 +58,7 @@ ve.ui.MWSaveDialog.static.actions = [
// May be overridden by config.saveButtonLabel
label: OO.ui.deferMsg( 'visualeditor-savedialog-label-review' ),
flags: [ 'primary', 'progressive' ],
modes: [ 'save', 'review', 'preview' ],
accessKey: 's'
modes: [ 'save', 'review', 'preview' ]
},
{
label: OO.ui.deferMsg( 'visualeditor-savedialog-label-resume-editing' ),
@ -498,8 +497,7 @@ ve.ui.MWSaveDialog.prototype.setEditSummary = function ( summary ) {
* @inheritdoc
*/
ve.ui.MWSaveDialog.prototype.initialize = function () {
var saveAccessKey,
dialog = this;
var dialog = this;
// Parent method
ve.ui.MWSaveDialog.super.prototype.initialize.call( this );
@ -643,14 +641,6 @@ ve.ui.MWSaveDialog.prototype.initialize = function () {
this.conflictPanel
] );
// Save button for "save" panel
saveAccessKey = ve.msg( 'accesskey-save' );
if ( saveAccessKey !== '-' && saveAccessKey !== '' ) {
this.actions.forEach( { actions: 'save' }, function ( action ) {
action.setAccessKey( saveAccessKey );
} );
}
// Initialization
this.$body.append( this.panels.$element );