1. 13 Oct, 2020 9 commits
  2. 12 Oct, 2020 6 commits
  3. 09 Oct, 2020 2 commits
    • Kyle Keating's avatar
      Fix mobile cursor from jumping to bottom · 3a28eddf
      Kyle Keating authored
      When selecting text on the android, it was possible to also highlight the text inside the buttons in the adder. When this happened, the range would grab everything from where you started to highlight to the very end of the dom because the adder is attached as the last node inside body.
      
      The simple fix is to prohibit text selection inside the adder which prevents the selection from getting the adder itself.
      3a28eddf
    • Lyza Danger Gardner's avatar
      Add a non-OCR'd PDF to the dev-server documents · 150e15b9
      Lyza Danger Gardner authored
      Add a non-OCR'd PDF available to the local dev server to aid
      developers
      150e15b9
  4. 08 Oct, 2020 4 commits
  5. 07 Oct, 2020 6 commits
  6. 06 Oct, 2020 13 commits
    • Lyza Danger Gardner's avatar
      Apply hover styling consistently to focused buttons · 484b4f11
      Lyza Danger Gardner authored
      The recently-added `button-hover` mixin, used by the base `button`
      mixin and thus inherited by other button mixins, applied hover styling
      to focused buttons, but other button mixins that adjust hover styling
      were not applying hover styling to focused buttons.
      
      Update mixins to consistently apply hovered styling to focused buttons
      
      Fixes #2610
      484b4f11
    • Kyle Keating's avatar
      Remove commented out assert.equal test · bf9a06fc
      Kyle Keating authored
      bf9a06fc
    • Robert Knight's avatar
      Handle case where `nodeFromXPath` returns a non-Element result · 275ea593
      Robert Knight authored
      Handle scenarios flagged by type checking where `nodeFromXPath` may
      return `null` or a non-Element node. Previously it could never return
      `null` but would throw an exception if the node was not found. In the
      new code a check is needed.
      
      The case where `nodeFromXPath` returned a non-Element node would never
      happen with XPaths generated by the client but could happen if an
      annotation was created via the API with a non-simple XPath.
      275ea593
    • Robert Knight's avatar
      Fix issue with `getTextNodes` and nodes from other iframes · 908c8159
      Robert Knight authored
      I don't believe this issue will ever occur in the real application, but
      we currently have tests (in `html-test.js`) where the passed node comes from
      a different iframe and therefore a different JS environment where globals including
      `Text` and `Element` have different identities.
      908c8159
    • Robert Knight's avatar
      Remove an unnecessary conditional · 28300faf
      Robert Knight authored
      The expression `n.data.length` cannot be nullish. This was left over
      from a previous version that read `n.nodeValue?.length`.
      28300faf
    • Robert Knight's avatar
      Add missing `return` to async test · feff02a8
      Robert Knight authored
      Rewrite an async test to use async/await syntax for readability and add
      a missing `return` so that mocha correctly waits for the test to finish
      before continuing.
      feff02a8
    • Robert Knight's avatar
      Fix range selector anchoring in XHTML documents · 39a806fc
      Robert Knight authored
      In HTML documents that have been served with an XML mime type,
      `document.evaluate` handles element names differently. In HTML documents
      the XPath segments do not require prefixes on element names. In XHTML
      documents however they do. Since the client always generates the same
      un-prefixed XPaths regardless of document type, evaluation always
      failed. There was a fallback path but it was only executed if
      `document.evaluate` threw an error, not if it returned `null` as in this
      case.
      
      This commit resolves the issue by first attempting to evaluate the XPath
      using custom logic that only handles simple XPaths and then using
      `document.evaluate` only for more complex XPaths. The _simple XPath_
      logic behaves the same in HTML and XML documents and ignores namespaces.
      As a result it works with the XPaths that the client generates
      regardless of document type and also regardless of whether the XPath
      references only HTML elements or elements from other namespaces (eg.
      MathML or SVG).
      
      We could change the way that the client generates XPaths in future in
      XML documents or SVG/MathML content within HTML documents, but the
      client would still need to handle `RangeSelector` selectors on existing
      annotations.
      
      For more details, see https://github.com/hypothesis/client/pull/2590#issuecomment-702132563
      
      Fixes #2592
      39a806fc
    • Robert Knight's avatar
      Simplify `range.commonAncestorContainer` update · 205b64df
      Robert Knight authored
      The test case given in the comment no longer fails in modern versions of Safari
      and I was unable to find any open or closed bug reports mentioning
      `Node.contains`. Since the comment referenced a very old version of
      Safari, I think it is reasonable to assume it has long been resolved.
      205b64df
    • Robert Knight's avatar
      Use `Text.data` instead of `Text.nodeValue` · 41d5c153
      Robert Knight authored
      `nodeValue` is an alias for `data` in text nodes, but `data` is never
      null, which keeps TS happy.
      41d5c153
    • Robert Knight's avatar
      Remove jQuery usage from range.js · a5540581
      Robert Knight authored
      As part of the removal of jQuery from the annotator, remove usage from
      `range.js`:
      
       - Replace `parents()` method with a small helper function
      
       - Rewrite `getTextNodes` function to accept and return DOM nodes rather
         than jQuery collections
      
       - Use `Node.contains` instead of jQuery's `contains` method. Note that there
         is a semantic difference that `contains(nodeA, nodeA)` returns
         `false` whereas `nodeA.contains(nodeA)` returns `true`. This enabled
         simplifying a condition.
      a5540581
    • Robert Knight's avatar
      Use `annotation` rather than `ann` for consistency · 74921778
      Robert Knight authored
      We use both terms to refer to an annotation in various places, but
      `annotation` is more common in this module.
      74921778
    • Robert Knight's avatar
      Improve type documentation in `AnnotationSync` · 5a9fa9d5
      Robert Knight authored
       - Remove an `callback: RpcCallback` argument which was unused
      
       - Document the type of annotation bodies and RPC messages
      5a9fa9d5
    • Robert Knight's avatar
      Rewrite the `AnnotationSync` class in the annotator · 9ff3954d
      Robert Knight authored
      The `AnnotationSync` class was an ES5-style class that had a ton of
      ES5-isms, odd constructions probably resulting from a historical
      conversion from CoffeeScript and unnecessary abstractions. It was also
      lacking in documentation.
      
      This commit rewrites the class using modern syntax and removing unused
      code and unnecessary abstractions (eg. the `_eventListeners` and
      `_channelListeners` properties).
      
      The API and behavior should be unchanged. An additional test was added
      for the `sync` method.
      9ff3954d