-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ignoring of events inside Hypothesis UI elements
The `maybeCloseSidebar` function inside guest.ts relied on events inside Hypothesis UI elements not reaching it because they were stopped at the shadow root boundary by the `stopEventPropagation` helper in shadow-root.ts. However this was broken because `maybeCloseSidebar` is called in response to `pointerdown` events but `stopEventPropagation` does not intercept this event. The issue usually went unnoticed because clicking in the sidebar's toggle button when it was closed resulted in the following sequence of events: 1. "pointerdown" event, processed by `maybeCloseSidebar`. This sent a redundant "closeSidebar" message to the sidebar when it was already closed. 2. "click" event handled, resulting in the sidebar opening. In some circumstances however, such as when tap-to-click is enabled on macOS [1], these events were sometimes received in the opposite order. As a result the sidebar was opened and then immediately closed. Simplify the approach by removing the logic for preventing event propagation and instead testing whether the element is a Hypothesis UI element inside `maybeCloseSidebar` by looking at its tag name. [^1]: https://hypothes-is.slack.com/archives/C4K6M7P5E/p1733756425323569
- Loading branch information
1 parent
c9e9d6d
commit e763a9a
Showing
4 changed files
with
34 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters