Prevent cursor from scrolling if multiple files are being rendered
After clicking Expand All, Gerrit begins to render the diffs and if
the user starts scrolling, the 'never' scroll behaviour is supposed to
prevent the scrolling of the user to the top.
We prevent any auto scrolling happening now after Expand All is
clicked.
This however introduces a regression in which the first chunk is not
focused on a small screen but we are fine in not supporting this use
case as of now.
Rename ScrollBehaviour to ScrollModes as Behaviours in Gerrit are
similar to mixins.
Move ScrollModes into constants.js
Change-Id: Ic904c01c5bf93934c8c9b215e35e4b1d95f4498d
diff --git a/polygerrit-ui/app/constants/constants.js b/polygerrit-ui/app/constants/constants.js
index 084bb0f..5001dd2 100644
--- a/polygerrit-ui/app/constants/constants.js
+++ b/polygerrit-ui/app/constants/constants.js
@@ -42,4 +42,16 @@
TAG_NEW_PATCHSET: 'autogenerated:gerrit:newPatchSet',
TAG_NEW_WIP_PATCHSET: 'autogenerated:gerrit:newWipPatchSet',
TAG_REVIEWER_UPDATE: 'autogenerated:gerrit:reviewerUpdate',
-};
\ No newline at end of file
+};
+
+/**
+ * @enum
+ * @desc Modes for gr-diff-cursor
+ * The scroll behavior for the cursor. Values are 'never' and
+ * 'keep-visible'. 'keep-visible' will only scroll if the cursor is beyond
+ * the viewport.
+ */
+export const ScrollModes = {
+ KEEP_VISIBLE: 'keep-visible',
+ NEVER: 'never',
+};