1. 03 Jul, 2023 6 commits
  2. 29 Jun, 2023 2 commits
  3. 26 Jun, 2023 10 commits
  4. 23 Jun, 2023 1 commit
  5. 22 Jun, 2023 3 commits
    • Robert Knight's avatar
      Await `_scrollToAnchor` result · 3bf184ab
      Robert Knight authored
      This doesn't have a functional consequence, but it is generally appropriate for
      async methods not to return until all the work they initiate is done.
      3bf184ab
    • Robert Knight's avatar
      Make top/bottom bucket scrolling work when using a custom bucket container · 6d76d194
      Robert Knight authored
      When using a custom bucket container, the top / bottom buckets may be positioned
      differently than the code previously assumed (137x px below the top of the
      viewport, 20px above the bottom). Redo the logic to work regardless of bucket
      container positioning. Instead of trying to determine whether an anchor is
      on-screen or not, just pick the anchor with the lowest bottom or highest top as
      the "nearest" one, depending on which direction we are scrolling in.
      
      This is implemented by:
      
       - Changing `Bucket` objects to record not just the tags from anchors in
         them, but the list of `AnchorPosition` objects from which the bucket
         was built. These objects include the top and bottom positions of the
         anchor.
      
       - Make clicking on the "Up" bucket search the anchor list for the
         anchor with the lowest bottom position, and send a request to the
         guest to scroll to that anchor.
      
       - Make clicking on the "Down" bucket search the anchor list for the
         anchor with the highest top position, and send a request to the
         guest to scroll to that anchor.
      
       - Removing all the logic for finding and scrolling to the "nearest
         off-screen anchor"
      6d76d194
    • Alejandro Celaya's avatar
  6. 21 Jun, 2023 2 commits
  7. 19 Jun, 2023 12 commits
  8. 16 Jun, 2023 4 commits
    • Robert Knight's avatar
      Add a note about a scenario where the thresholds will be inappropriate · 82b176d0
      Robert Knight authored
      This function is used to scroll to the "nearest" highlight when clicking the
      top/bottom buckets in the bucket bar. This can likely be reimplemented in a
      simpler way in future that doesn't rely on knowing where the buckets are
      relative to the viewport. If instead we assume that all the passed-in anchors
      are off-screen, we could just scroll to the top/bottom one.
      82b176d0
    • Robert Knight's avatar
      Rename `bucketBarContainer` config to `bucketContainerSelector` · 839d44bf
      Robert Knight authored
      We have settled on this for the moment for consistency with
      `externalContainerSelector`, although the "Selector" suffix is a bit verbose,
      and this could be a problem if we want to support specifying an HTML element
      directly via JS config, rather than a selector.
      839d44bf
    • Robert Knight's avatar
      Fix flex direction for bucket bar container · aab247bd
      Robert Knight authored
       - Correct `flex-column` => `flex-col`
       - Make the `<hypothesis-bucket-bar>` flex-grow to fill its container
         vertically
       - Add a note about why we set `width: 100%`
      aab247bd
    • Robert Knight's avatar
      Support rendering bucket bar inside a custom container · 3dae6e1a
      Robert Knight authored
      Revise how the bucket bar rendering and bucket position calculations work to
      remove the assumptions about where the bucket bar will be rendered relative to
      the viewport. Then use this new flexibility to support a `bucketBarContainer`
      config option which allows the host page to specify a selector for an existing
      DOM element where the bucket bar will be rendered. The initial use case is the
      video player where we want to render the bucket bar alongside the transcript
      rather than the sidebar. In future this can support other use cases where the
      document content is in some scrollable container that doesn't fill the viewport.
      
       - Render bucket bar into its own shadow root, so its styles work when the
         bucket bar is rendered into a custom container.
      
       - Add `container` argument to `computeBuckets` helper, and compute bucket
         positions relative to this container instead of the viewport.
      
       - Remove the hard-coded knowledge in `computeBuckets` about the vertical
         toolbar above the bucket bar, and instead change the positioning of the
         default bucket bar container so that it is below the vertical toolbar at the
         edge of the sidebar.
      
       - Move the gray background behind the bucket bar out of the `Buckets` component
         and into a separate element rendered by the toolbar. This is needed so that
         the background is still displayed even if the bucket bar is rendered into a
         custom container.
      
         In the process of adding this separate element, tweak the layout so
         that the right edge of the buckets aligns with the right edge of
         the toolbar icons.
      
       - Add a `bucketBarContainer` config option which specifies a selector for an
         element to render the bucket bar into.
      3dae6e1a