jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/338275 )
Change subject: Don't allow slug buttons to take focus on click ...................................................................... Don't allow slug buttons to take focus on click Bug: T158295 Change-Id: I80dee4134f39fc2e9416d570af20c920b9a0a209 --- M build/modules.json M demos/ve/desktop.html M demos/ve/mobile.html M src/ce/ve.ce.BranchNode.js A src/ui/widgets/ve.ui.NoFocusButtonWidget.js M tests/index.html 6 files changed, 16 insertions(+), 1 deletion(-) Approvals: Bartosz Dziewoński: Looks good to me, approved jenkins-bot: Verified diff --git a/build/modules.json b/build/modules.json index c6f2a81..dde28f9 100644 --- a/build/modules.json +++ b/build/modules.json @@ -529,6 +529,7 @@ "src/ui/widgets/ve.ui.ContextOptionWidget.js", "src/ui/widgets/ve.ui.DimensionsWidget.js", "src/ui/widgets/ve.ui.MediaSizeWidget.js", + "src/ui/widgets/ve.ui.NoFocusButtonWidget.js", "src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js", "src/ui/tools/ve.ui.AnnotationTool.js", "src/ui/tools/ve.ui.ClearAnnotationTool.js", diff --git a/demos/ve/desktop.html b/demos/ve/desktop.html index 99a138e..93c78e1 100644 --- a/demos/ve/desktop.html +++ b/demos/ve/desktop.html @@ -467,6 +467,7 @@ <script src="../../src/ui/widgets/ve.ui.ContextOptionWidget.js"></script> <script src="../../src/ui/widgets/ve.ui.DimensionsWidget.js"></script> <script src="../../src/ui/widgets/ve.ui.MediaSizeWidget.js"></script> + <script src="../../src/ui/widgets/ve.ui.NoFocusButtonWidget.js"></script> <script src="../../src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js"></script> <script src="../../src/ui/tools/ve.ui.AnnotationTool.js"></script> <script src="../../src/ui/tools/ve.ui.ClearAnnotationTool.js"></script> diff --git a/demos/ve/mobile.html b/demos/ve/mobile.html index 547acd2..5c7cb1c 100644 --- a/demos/ve/mobile.html +++ b/demos/ve/mobile.html @@ -467,6 +467,7 @@ <script src="../../src/ui/widgets/ve.ui.ContextOptionWidget.js"></script> <script src="../../src/ui/widgets/ve.ui.DimensionsWidget.js"></script> <script src="../../src/ui/widgets/ve.ui.MediaSizeWidget.js"></script> + <script src="../../src/ui/widgets/ve.ui.NoFocusButtonWidget.js"></script> <script src="../../src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js"></script> <script src="../../src/ui/tools/ve.ui.AnnotationTool.js"></script> <script src="../../src/ui/tools/ve.ui.ClearAnnotationTool.js"></script> diff --git a/src/ce/ve.ce.BranchNode.js b/src/ce/ve.ce.BranchNode.js index 640431f..6e680e8 100644 --- a/src/ce/ve.ce.BranchNode.js +++ b/src/ce/ve.ce.BranchNode.js @@ -300,7 +300,7 @@ } this.slugNodes[ i ] = slugNode; if ( isBlock ) { - slugButton = new OO.ui.ButtonWidget( { + slugButton = new ve.ui.NoFocusButtonWidget( { label: ve.msg( 'visualeditor-slug-insert' ), icon: 'add', framed: false diff --git a/src/ui/widgets/ve.ui.NoFocusButtonWidget.js b/src/ui/widgets/ve.ui.NoFocusButtonWidget.js new file mode 100644 index 0000000..46b7371 --- /dev/null +++ b/src/ui/widgets/ve.ui.NoFocusButtonWidget.js @@ -0,0 +1,11 @@ +/** + * Button widget that cancels mousedown events. + * + * TODO: Make cancelButtonMouseDownEvents an upstream param, + * instead of requiring inheritance. + */ +ve.ui.NoFocusButtonWidget = function NoFocusButtonWidget() { + ve.ui.NoFocusButtonWidget.super.apply( this, arguments ); +}; +OO.inheritClass( ve.ui.NoFocusButtonWidget, OO.ui.ButtonWidget ); +ve.ui.NoFocusButtonWidget.static.cancelButtonMouseDownEvents = true; diff --git a/tests/index.html b/tests/index.html index 0cab8eb..aa0956d 100644 --- a/tests/index.html +++ b/tests/index.html @@ -386,6 +386,7 @@ <script src="../src/ui/widgets/ve.ui.ContextOptionWidget.js"></script> <script src="../src/ui/widgets/ve.ui.DimensionsWidget.js"></script> <script src="../src/ui/widgets/ve.ui.MediaSizeWidget.js"></script> + <script src="../src/ui/widgets/ve.ui.NoFocusButtonWidget.js"></script> <script src="../src/ui/widgets/ve.ui.WhitespacePreservingTextInputWidget.js"></script> <script src="../src/ui/tools/ve.ui.AnnotationTool.js"></script> <script src="../src/ui/tools/ve.ui.ClearAnnotationTool.js"></script> -- To view, visit https://gerrit.wikimedia.org/r/338275 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I80dee4134f39fc2e9416d570af20c920b9a0a209 Gerrit-PatchSet: 2 Gerrit-Project: VisualEditor/VisualEditor Gerrit-Branch: master Gerrit-Owner: Esanders <esand...@wikimedia.org> Gerrit-Reviewer: Bartosz Dziewoński <matma....@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits