1. 06 May, 2022 9 commits
  2. 05 May, 2022 8 commits
    • Robert Knight's avatar
      s/Setup/Set up · beb10ec9
      Robert Knight authored
      beb10ec9
    • Robert Knight's avatar
      Remove flag map argument from "flagsChanged" event · f4d0412b
      Robert Knight authored
      This encourages reading of specific flags to be done via `flagEnabled`, which
      checks for usage of unknown flags.
      f4d0412b
    • Robert Knight's avatar
      Support feature flags in guest frames · 928548b0
      Robert Knight authored
      Rewrite the infrastructure that sends feature flags to annotator code, to
      support feature-flagging functionality in guest frames, instead of just the host
      frame.
      
       - Remove `FeaturesService` in the sidebar and move the logic for
         syncing feature flags from the sidebar to other frames into
         `FrameSyncService`.  This is a better place since `FrameSyncService`
         knows when frames connect and thus when to send flags to them. The
         logic for monitoring for flag changes is very simple and doesn't
         needs its own service.
      
       - Within `FrameSyncService`, send "featureFlagsUpdated" notifications to
         both host frames and guest frames.
      
       - Convert the functions and global variables in `annotator/features.js`
         into a `FeatureFlags` class, which encapsulates storage of flags,
         access to them and notifying consumers when flags change.
      
       - Instantiate `FeatureFlags` instances in the host frame and guest
         frame and update the flags stored in them when "featureFlagsUpdated" events
         are received from the sidebar.
      928548b0
    • Robert Knight's avatar
      Add link to roving tabindex reference · 5783f7eb
      Robert Knight authored
      5783f7eb
    • Robert Knight's avatar
      Optimize readability of several tests · 8e7cd3ca
      Robert Knight authored
       - Rename `getElement` => `findElementByTestId` for clarity
       - Eliminate unnecessary `context` blocks in `MarkdownEditor` tests
       - Narrow scope of `console.warn` suppression in `useArrowKeyNavigation`
         test
       - Explain why keyboard navigation tests do not use Enzyme
      8e7cd3ca
    • Robert Knight's avatar
      Extract arrow key navigation into a reusable hook · ab16a393
      Robert Knight authored
      Extract the arrow key navigation logic from `MarkdownEditor` into a
      reusable `useArrowKeyNavigation` navigation hook. This simplifies the
      MarkdownEditor component and will allow us to enable arrow key
      navigation more widely thoughout the application.
      
      A notable design choice is that the roving tab index state lives in the DOM
      rather than in Preact. This enables the Preact component-facing API to be very
      simple: a single hook call in the component that renders the container element
      (of the toolbar, menu bar etc.). It does mean however that the `tabIndex` state
      is not accessible to components. This works for the use cases where I have
      tested it, but we may need to revisit in future.
      
      If browsers add a native feature to handle this in future [1], the hook
      could handle testing for support and using it where available.
      
       - Create `useArrowKeyNavigation` navigation hook in
         `src/shared/keyboard-navigation.js` as a general method of adding
         arrow key navigation to a composite widget
      
       - Modify `MarkdownEditor` to use the `useArrowKeyNavigation` hook to
         handle arrow key navigation
      
       - Replace detailed tests for arrow key navigation in `MarkdownEditor`
         with more basic tests, as the `useArrowKeyNavigation` tests cover the
         general functionality in detail
      
      [1] eg. https://github.com/MicrosoftEdge/MSEdgeExplainers/blob/main/Focusgroup/explainer.md
      ab16a393
    • Robert Knight's avatar
      Make `ListenerCollection.add` smarter · b436080d
      Robert Knight authored
      Enable the `ListenerCollection.add` method to know the specific type of
      event that a listener will receive, based on the event target and event
      name. This simplifies usage by removing the need to cast the argument in
      most cases.
      
      The implementation relies on the target having an `on${eventName}`
      property from which the event type can be extracted. If it doesn't, it
      will fall back to `Event`.
      b436080d
    • Robert Knight's avatar
      Replace various uses of `any` with `unknown` · 54cd9438
      Robert Knight authored
      This includes the results of RPC calls to the LMS app, which must now be
      explicitly cast to the expected result type.
      54cd9438
  3. 03 May, 2022 7 commits
  4. 02 May, 2022 16 commits