From b976f2cf383311f8e9b1daa1009afdae6f3fbb26 Mon Sep 17 00:00:00 2001 From: David Lynch Date: Thu, 26 Jan 2017 10:11:45 -0600 Subject: [PATCH] MWSaveDialog: only focus summary if we're on the save panel Firefox throws exceptions when trying to focus hidden inputs. Using the "preview" keyboard shortcut entirely bypasses the save panel, but the ready process assumes it'll always be opened first. Bug: T153958 Change-Id: Ifb3861116565e77c30b3874fe47889298c3ace6d --- modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js index 687897b4f5..e7c0a39992 100644 --- a/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js +++ b/modules/ve-mw/ui/dialogs/ve.ui.MWSaveDialog.js @@ -584,8 +584,14 @@ ve.ui.MWSaveDialog.prototype.getSetupProcess = function ( data ) { ve.ui.MWSaveDialog.prototype.getReadyProcess = function ( data ) { return ve.ui.MWSaveDialog.super.prototype.getReadyProcess.call( this, data ) .next( function () { - // This includes a #focus call - this.editSummaryInput.moveCursorToEnd(); + // Support: Firefox + // In Firefox, trying to focus a hidden input will throw an + // exception. This would happen when opening the preview via + // keyboard shortcut. + if ( this.panels.getCurrentItem() === this.savePanel ) { + // This includes a #focus call + this.editSummaryInput.moveCursorToEnd(); + } }, this ); };