Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
docs: Add documentation for capturing screenshots.
Karl Stolley106480a9bac2
diff --git a/docs/contributing/presenting-visual-changes.md b/docs/contributing/presenting-visual-changes.mdindex 3ea607c2b6d..0715b10e920 100644--- a/docs/contributing/presenting-visual-changes.md+++ b/docs/contributing/presenting-visual-changes.md@@ -1,3 +1,198 @@+# Documenting visual changes++PRs that touch Zulip's user interface must include precise screenshots+that document the Before and After states associated with the PR's changes.+Even if your PR doesn't modify Zulip's CSS, it is commonly the case that+template adjustments and changes to JavaScript that touch the DOM may cause+visual changes that must be documented as part of a successful PR. That+includes demonstrating that your PR introduces no changes whatsoever, which+is typical with refactoring and other code-quality work.++## Capturing precise screenshots++Precise sets of static screenshots take a little bit of effort to capture, but+are well worth your time to create, and your reviewers' time too.++:::{important}+**You might ask, "Why can't I just make a video showing my changes?"** The answer is+that static screenshots are much easier to compare than screencast videos. Whenever+possible, use still screenshots instead of videos. (If you absolutely must include+a video, you'll find guidance further down this page for doing so appropriately.)+:::++Git is, of course, your friend for setting up the UI state for Before and After screenshots: typically the Before shot will be of the `main` branch updated from+upstream, while the After shot will be of your PR's working branch. Take the time+to rebase your working branch over the latest `main`, too, before capturing your+screenshots.++Sometimes you may be asked to present alternative looks to your PR in tandem with a+discussion on CZO in the [#design](https://chat.zulip.org/#topics/channel/101-design)+channel, in which case you'll need to walk through different commits on your branch—or+make judicious use of `git stash` and `git stash pop`.++Precise sets of Before/After screenshots have two essential qualities:++1. **The state of the UI should be identical between screenshots.**+ For example, a screenshot of the message feed should have messages scrolled to the+ same spot, the focus ring should be around the same message, etc. The goal is to+ highlight the differences your PR introduces, and not include any unintended noise in+ the screenshots from things that just happen to be different.+1. **The screenshots must have the exact same pixel dimensions.** If the Before+ screenshot is 800px by 600px, the After screenshot should be too. This is+ to make sure that there's a pixel-to-pixel correspondence of everything+ you've captured onscreen.++The next sections describe different techniques for capturing pixel-precise+screen captures. To master these techniques, you'll likely need to spend some time+working with your capture tools of choice, whether they're part of your browser or+operating system, or a third-party screen capture tool or browser plugin. You should+also take the time to read about+[why precise screenshots matter](#why-precise-screenshots-matter).++### Capturing precise screenshots with your browser++The easiest cross-platform way of capturing screenshots of your PR's changes+is to use your browser. Both Chrome and Firefox have built-in screenshot capabilities,+so it's worth your time to explore how those work. Firefox's capabilities are neatly+tied to its responsive design view, which means you can very precisely size the viewport+to highlight the changes in your PR. (And if you're not used to developing in Firefox,+this can be a convenient way to check your work in a different browser, too.)++For example, it's easy to capture a mobile-scale viewport in Firefox like this:++| In responsive mode for capture | Resulting screenshot |+| ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |+|  |  |++For another example, if you're making changes to the left sidebar, you'll want to open+the viewport even wider, until the left sidebar is showing:++++The great thing about capturing screenshots in your browser is that it is very easy to ensure that you meet both criteria for precise screenshots: a UI in the same state for+the Before and After shots, and screenshots that are the same exact dimensions—easily verified by the values you set on the width and height of the viewport.++Additionally, if you need to demonstrate states like `:hover` or `:active` on an element,+you can use your browser's developer tools to emulate that state for you, without your+needing to fiddle with the keyboard or mouse.++### Capturing precise screenshots with native OS tools++Most of the time, browser-captured screenshots are ideal. Screens are generally+high-enough resolution that your reviewers (and you) can quickly recognize any+changes just by comparing the full-size screenshots.++However, if you really do need to illustrate a change in closer detail, it can be helpful+to use your operating system's native screen-capture tools. See if your OS allows+you to specify a box of fixed dimensions that you can use to repeatedly capture the same+area of the screen.++For example, perhaps there's something very subtle about the channel list that a PR needs+to highlight:++++Note that [a fixed, reusable capture box is different from a freehand capture](#freehand-versus-fixed-screenshots),+because the OS enables you to call up the same fixed-size box for repeated screenshots+of the same region of the screen, helping you to maintain pixel precision in the+Before and After shots. Just be careful not to move your browser window around between+shots.++### Capturing precise screenshots with other software++If you find that your operating system or browser's tools are insufficient for capturing+the screenshots that you need, you might want to explore [third-party software](#screenshot-and-gif-software). Just keep+in mind the two qualities your screenshots need to maintain: identical UI state, and+pixel-precise dimensions between Before and After shots.++### Capturing and presenting short videos++Still screenshots are almost always superior to videos. If you absolutely must show off+a brief interaction on your PR, see whether your operating system will allow you to again+set a fixed box for capturing video of a region of your screen.++Be sure to edit your video down to the shortest length possible. And rather+than post the video—whose format may not be suitable for the web or accessible to all+reviewers—use a video-to-GIF service like [ezgif.com](https://ezgif.com/video-to-gif)+to create a looping animation showing off the interaction.++Here, for an example, is a short looping animation from [an actual PR](https://github.com/zulip/zulip/pull/35969)+that modified some interactions on the compose box:++++It's worth noting here that [the full PR](https://github.com/zulip/zulip/pull/35969)+included plenty of static screenshots in addition to the GIFs showing off interactivity.++## Why precise screenshots matter++Precise screenshots are necessary not only to document your intended+changes, but also to demonstrate that there are no unintended side-effects+or visual regressions. In fact, PRs that refactor templates or CSS often+include screenshots to explicitly demonstrate that there are no visual changes.++Capturing precise screenshots serves two primary purposes:++1. For you as a contributor, checking your own screenshots will help you+ to catch any regressions on your own, prior to submitting your PR, or+ to point out changes or shifts for reviewers and possibly further design+ discussion.+2. For reviewers, checking screenshots is a very quick way to verify that+ a PR does what it intends without the reviewer needing to pull down the+ PR and check it more closely in development (though that is a routine+ part of reviewing as well).++### Freehand versus fixed screenshots++It may be tempting to freehand your screenshots, perhaps by using your operating+system's screen-capture utility that allows freehand dragging of a capture area.+The two freehand-captured images below represent Before and After states. Can you+spot any changes to the UI? How about if you open each image in a separate tab in+your browser? (Typically a reviewer will open up the full-size images in separate+tabs in order to more easily compare them.)++| Before | After |+| --------------------------------------------------------------- | ------------------------------------------------------------- |+|  |  |++Here's an animated GIF approximating a comparison of the full-size images:++++Compare those to this set of screenshots. These are the same Before and After+states as captured in the freehand shots above, but these have been captured using+a fixed box offered by an operating system's native screen-capture utility:++| Before | After |+| --------------------------------------------------------- | ------------------------------------------------------- |+|  |  |++Now see if you can catch the change between the Before and After images in this GIF:++++Those screenshots make it obvious that the space between the Zulip logo and the top+of the message area has been reduced. Without precise screenshots, that change+would've been nearly impossible to detect.++### Providing sufficient UI context++The images above might have been intended to show close details of the Zulip logo+and message area. But the contributor could have also just used their browser+(Firefox, in this case) to capture more of the viewport:++| Before | After |+| ----------------------------------------------------------------- | --------------------------------------------------------------- |+|  |  |++Even if your work is targeted at a specific element, detailed screenshots are not+always the best choice. CSS adjustments are notorious for having unintended consequences,+so it's often a smart choice to show as much of the UI as you can.++As with the fixed-box screenshots above, having pixel-precise screenshots+where the UI is in an identical state and there isn't a bunch of unintended movement+or other noise, the browser captures above make catching the space shift much easier.+# Screenshot and GIF softwareThe following list documents different screenshotting & GIF-making techniques anddiff --git a/docs/contributing/reviewable-prs.md b/docs/contributing/reviewable-prs.mdindex 5dc82eb0b46..26842be7b6d 100644--- a/docs/contributing/reviewable-prs.md+++ b/docs/contributing/reviewable-prs.md@@ -14,8 +14,8 @@ step is described in detail below, with links to additional resources:1. [Organize your proposed changes](#organize-your-proposed-changes) into aseries of commits that tell the story of how the codebase will change.1. [Explain your changes](#explain-your-changes) in the description for your- pull request, including [screenshots](#demonstrating-visual-changes) for- visual changes.+ pull request, including [screenshots](#presenting-screenshots-on-your-pull-request)+ for visual changes.1. Carefully [review your own work](#review-your-own-work).1. [Submit your pull request](#submit-your-pull-request-for-review) for review.@@ -83,8 +83,8 @@ description for your pull request, you will:The review process will go a lot more smoothly if points of uncertainty areexplicitly laid out.- Include screenshots for all visual changes, so that they can be reviewed- without running your code. See [below](#demonstrating-visual-changes) for- detailed instructions.+ without running your code. See [below](#presenting-screenshots-on-your-pull-request)+ for detailed instructions.If you have a question about a specific part of your code that you expect to beresolved during the review process, put it in a PR comment attached to a@@ -156,7 +156,7 @@ review:[github-help-draft-pr]: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests#draft-pull-requests-## Demonstrating visual changes+## Presenting screenshots on your pull request- For [screenshots or screencasts][screenshots-gifs] of changes,putting them in details/summary tags reduces visual clutterdiff --git a/docs/images/browser-capture-after.png b/docs/images/browser-capture-after.pngnew file mode 100644index 00000000000..928c6265834Binary files /dev/null and b/docs/images/browser-capture-after.png differdiff --git a/docs/images/browser-capture-before.png b/docs/images/browser-capture-before.pngnew file mode 100644index 00000000000..1378a53d557Binary files /dev/null and b/docs/images/browser-capture-before.png differdiff --git a/docs/images/firefox-mobile-scale-350x600.png b/docs/images/firefox-mobile-scale-350x600.pngnew file mode 100644index 00000000000..191d7702540Binary files /dev/null and b/docs/images/firefox-mobile-scale-350x600.png differdiff --git a/docs/images/firefox-rwd-capture-medium.png b/docs/images/firefox-rwd-capture-medium.pngnew file mode 100644index 00000000000..d1a21313076Binary files /dev/null and b/docs/images/firefox-rwd-capture-medium.png differdiff --git a/docs/images/firefox-rwd-capture-mobile.png b/docs/images/firefox-rwd-capture-mobile.pngnew file mode 100644index 00000000000..c033d3e7592Binary files /dev/null and b/docs/images/firefox-rwd-capture-mobile.png differdiff --git a/docs/images/fixed-cap-after.png b/docs/images/fixed-cap-after.pngnew file mode 100644index 00000000000..5719f1734e6Binary files /dev/null and b/docs/images/fixed-cap-after.png differdiff --git a/docs/images/fixed-cap-before.png b/docs/images/fixed-cap-before.pngnew file mode 100644index 00000000000..922f6ab39bbBinary files /dev/null and b/docs/images/fixed-cap-before.png differdiff --git a/docs/images/fixed-capture-compare.gif b/docs/images/fixed-capture-compare.gifnew file mode 100644index 00000000000..ebd664811d6Binary files /dev/null and b/docs/images/fixed-capture-compare.gif differdiff --git a/docs/images/freehand-cap-after.png b/docs/images/freehand-cap-after.pngnew file mode 100644index 00000000000..ed4034c1c05Binary files /dev/null and b/docs/images/freehand-cap-after.png differdiff --git a/docs/images/freehand-cap-before.png b/docs/images/freehand-cap-before.pngnew file mode 100644index 00000000000..ecd291790aeBinary files /dev/null and b/docs/images/freehand-cap-before.png differdiff --git a/docs/images/freehand-capture-compare.gif b/docs/images/freehand-capture-compare.gifnew file mode 100644index 00000000000..caa11b3acdcBinary files /dev/null and b/docs/images/freehand-capture-compare.gif differdiff --git a/docs/images/general-chat-after.gif b/docs/images/general-chat-after.gifnew file mode 100644index 00000000000..77fcb45cb01Binary files /dev/null and b/docs/images/general-chat-after.gif differdiff --git a/docs/images/os-fixed-capture-box.png b/docs/images/os-fixed-capture-box.pngnew file mode 100644index 00000000000..a4f12705b96Binary files /dev/null and b/docs/images/os-fixed-capture-box.png differ