harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
36 stars 30 forks source link

Correct overlapping annotations and improve usability #1885

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

Fixes #1872

After talking with @cath9 we settled on a Google Docs-like presentation for annotations in the margin. Previously these could easily overlap because they were absolutely positioned and would land in the same spot if multiple notes appeared in the same source line.

After a number of fancy attempts to reflow the positions in code, I had the obvious-in-retrospect thought to see what the regular site does, and they're simple floats that lay out themselves. Bright idea, past LIL!

Added highlights that appear on hover or keyboard nav that visually link the note to the text. They're bidirectional, so hovering over either the note or the annotated text works. (This is entirely CSS and relies on the has: operator for one direction; in Firefox only hovering over the note will produce the effect until that support is added this year.)

https://user-images.githubusercontent.com/19571/214433977-1b020395-b3ab-4ade-8601-fa953a5c67d1.mov

Couple other changes:

Note: the annotations here are keyboard accessible but not accessible to screenreaders. I haven't researched this yet but I'd like the annotation to be made available to the reader when the annotated text is selected.

codecov-commenter commented 1 year ago

Codecov Report

Merging #1885 (4ea0dbb) into develop (53c00bb) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff            @@
##           develop    #1885   +/-   ##
========================================
  Coverage    76.76%   76.76%           
========================================
  Files           55       55           
  Lines         6628     6628           
========================================
  Hits          5088     5088           
  Misses        1540     1540           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.