Skip to content

Add an "About the Annotation editor" link above the editor toolbar, behind a flag - #7594

Merged
santicomp2014 merged 1 commit into
mainfrom
annotation-editor-info
Nov 11, 2026
Merged

santicomp2014 merged 1 commit into
mainfrom
annotation-editor-info

Conversation

@santicomp2014

Copy link
Copy Markdown
Contributor

Adds an "About the Annotation editor" link above the annotation editor's toolbar. It is behind a feature flag that is off by default, so merging this changes nothing for users.

Part of hypothesis/product-backlog#1753

Why

WCAG 3.3.2 asks for a cue for the purpose of the editor's text field that is always visible. The only cue the field has today is its placeholder ("Enter comment"), which goes away as soon as there is text in it.

What changes

When the flag is on, the editor shows an info icon that links to the Help Center article about the editor, https://web.hypothes.is/help/using-the-annotation-editor/

  • It is in a row of its own above the toolbar, at the left, under the group name. It is not inside the toolbar, so it is a separate tab stop and it is not part of the toolbar's arrow-key navigation.
  • It comes before the toolbar in the DOM, so the tab order is: info link, toolbar, text field.
  • It is rendered for as long as the editor is open, including in preview mode. It does not depend on hover or focus.
  • It opens in a new tab (target="_blank", rel="noopener noreferrer"), so the draft is not lost.
  • Tooltip (title): "About the Annotation editor"
  • Accessible name (aria-label): "About the Annotation editor. Learn what this text field is for. Opens Help Center article in a new tab."

The "Formatting help" link in the toolbar is not changed. It is a separate thing.

MarkdownEditor gets a showEditorInfoLink prop (default false), in the same way as showHelpLink and mentionsEnabled. AnnotationEditor reads the flag from the store and passes it down.

The icon

The icon follows the decision from the 10 November product meeting: a plain info "i" on a filled grey circle, instead of the text field pictogram with a red badge that is in the issue. The pictogram read as a notification. There is no red in this.

  • It is InfoIcon from @hypothesis/frontend-shared, which the sidebar already uses for "About thumbnail descriptions". There is no new icon component and no change to dependencies.
  • Size: the icon is 16px, inside a 24x24px link. For comparison, a formatting button is 26x30px with a 10px glyph. So the link is a little smaller than a formatting button, and the icon is larger than the formatting glyphs and solid, which should stop it from reading as one more formatting tool. 16px is also the size the icon is drawn at, so the "i" falls on whole pixels. On touch devices the link is 44x44px, like the other controls.
  • Color: text-grey-7 (#595959), and grey-9 (#202020) on hover. These are the colors of the toolbar's icon buttons. Links in the sidebar are red by default, so the link sets the grey itself and a test checks that the rendered color is a grey.

Contrast (WCAG relative luminance):

Pair Ratio Needed
Grey circle #595959 on the card background #FFFFFF 7.00:1 3:1
White "i" on the grey circle #595959 7.00:1 4.5:1
On hover: circle #202020 on #FFFFFF, and the "i" on it 16.29:1 3:1 and 4.5:1

The two ratios are the same number because the "i" is a hole in the shared icon, not a white shape. What shows through it is the card background, which is white (bg-white on Card).

How it is gated

The link is shown when the annotation_editor_info feature flag is on. The flag is added to h in hypothesis/h#10226.

This is safe to ship before the h change: the client treats a flag it does not get from h as off.

To turn it on: in h admin, on the feature flags page, enable annotation_editor_info for everyone, first-party users, admins, staff, or a cohort. It will go to staging first, for a screenshot review, before the flag is turned on anywhere in production.

One more condition: like the "Formatting help" link, this link is not shown when the Help panel is disabled (enableHelpPanel: false in the service config), even if the flag is on. That setting exists to remove links to external websites (see 61708eb).

Testing

New tests:

  • MarkdownEditor: the link is not rendered by default and the output is the same as with the prop set to false; href, target, rel, title and aria-label; the icon is the info icon, 16px, and grey; the link comes before the toolbar in DOM order and is the first tab stop; arrow keys in the toolbar do not reach it; it stays in preview mode; the "Formatting help" link is unaffected.
  • AnnotationEditor: the link is off by default, off when only other flags are on, on with annotation_editor_info, off when the Help panel is disabled, and it is in the DOM before the toolbar when the real editor is rendered.
  • checkAccessibility scenarios with the link shown, in both test files.

Run locally:

  • yarn checkformatting, yarn lint, yarn typecheck: all pass.
  • yarn test (the whole suite): 4390 passed.
  • I broke the change on purpose (link after the toolbar, grey classes removed) and the new tests failed, as they should.
  • yarn build on this branch and on main: the boot script is the same in both apart from the asset manifest that is embedded in it, where only the cache-busting hashes of sidebar.bundle.js, sidebar.css and ui-playground.css (and their source maps) differ. Nothing under src/boot, no build configuration and no dependency is touched.

Measured in the test runner's headless Chromium with the built sidebar CSS, in a container with the card's classes: the icon's left edge is in line with the left edge of the toolbar and of the text above it, there are 8px between the icon and the toolbar, the rendered color is rgb(89, 89, 89), and the accessible name that axe-core computes is the aria-label above.

Not verified

  • I have not looked at this in a real browser, and there is no screenshot. The layout numbers above come from the test runner. Whether the size and the spacing look right is for the staging review.
  • Not tried with a screen reader, on a touch device, or in forced-colors mode.

🤖 Generated with Claude Code

WCAG 3.3.2 asks for a cue for the purpose of the annotation editor's text
field that is always visible. The only cue the field has is its
placeholder, which goes away as soon as there is text in it.

Show an info icon that links to the Help Center article about the editor.
It is in a row of its own above the toolbar, so it is a separate tab stop
that comes before the formatting buttons, and it is there for as long as
the editor is open, including in preview mode. The article opens in a new
tab, so the draft is not lost.

The icon is `InfoIcon` from the shared icon set, at 16px inside a 24px
link, in the same grey as the toolbar icons.

This is behind the `annotation_editor_info` feature flag, which is off by
default, so it can be released before it has been approved. Like the
"Formatting help" link, it is not shown when the Help panel is disabled,
because that setting exists to remove links to external websites.

Part of hypothesis/product-backlog#1753

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.62%. Comparing base (f49e855) to head (0337801).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7594   +/-   ##
=======================================
  Coverage   99.62%   99.62%           
=======================================
  Files         286      286           
  Lines       12056    12061    +5     
  Branches     2932     2935    +3     
=======================================
+ Hits        12011    12016    +5     
  Misses         45       45           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@santicomp2014
santicomp2014 merged commit b1c5852 into main Nov 11, 2026
4 checks passed
@santicomp2014
santicomp2014 deleted the annotation-editor-info branch November 11, 2026 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants