Robmoen has uploaded a new change for review. https://gerrit.wikimedia.org/r/73015
Change subject: Bind listener to keyup to capture arrows & better math for scrolling. ...................................................................... Bind listener to keyup to capture arrows & better math for scrolling. Listen to keyup to properly capture and respond to up and down arrows. Rewrite calculation for scroll to better follow toolbar obscured cursor. Bug: 48787 Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa --- M modules/ve/ui/ve.ui.Toolbar.js 1 file changed, 5 insertions(+), 5 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VisualEditor refs/changes/15/73015/1 diff --git a/modules/ve/ui/ve.ui.Toolbar.js b/modules/ve/ui/ve.ui.Toolbar.js index 194a59c..3bbe0dc 100644 --- a/modules/ve/ui/ve.ui.Toolbar.js +++ b/modules/ve/ui/ve.ui.Toolbar.js @@ -40,7 +40,7 @@ 'scroll': ve.bind( this.onWindowScroll, this ) }; this.surfaceViewEvents = { - 'keypress': ve.bind( this.onSurfaceViewKeyPress, this ) + 'keyup': ve.bind( this.onSurfaceViewKeyup, this ) }; // Events @@ -125,14 +125,14 @@ }; /** - * Method to scroll to the cursor position while toolbar is floating on keypress only if + * Method to scroll to the cursor position while toolbar is floating on keyup only if * the cursor is obscured by the toolbar. * */ -ve.ui.Toolbar.prototype.onSurfaceViewKeyPress = function () { +ve.ui.Toolbar.prototype.onSurfaceViewKeyup = function () { var cursorPos = this.surface.view.getSelectionRect(), - scrollTo = cursorPos.end.y - this.surface.view.$.offset().top, - obscured = cursorPos.end.y - this.$window.scrollTop() < this.$.height() + this.$.offset().top; + scrollTo = this.$bar.offset().top - this.$bar.height() + ( cursorPos.end.y - cursorPos.start.y ), + obscured = cursorPos.start.y - this.$window.scrollTop() < this.$bar.height(); // If toolbar is floating and cursor is obscured, scroll cursor into view if ( obscured && this.floating ) { -- To view, visit https://gerrit.wikimedia.org/r/73015 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia46fb15ec9a8c07b3945b53a6545897ca23e59fa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/VisualEditor Gerrit-Branch: master Gerrit-Owner: Robmoen <rm...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits