-
-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent pointer events from triggering on elements behind hitAreaMarg…
…ins (#338) Fixing a problem described in #336 To solve the issue of click events passing through the hitAreaMargins to the elements behind them all we need to do is handle the events in the capture phase and prevent them from bubbling down to the children/panel content by calling `event.stopPropagation()`. However cancelling the mouse/touch events (for exmaple `mousedown`/`touchstart`), does not cancel their pointer event counterparts (`pointerdown`), like it does the other way around. So I also changed the event handlers to listen to the pointer events instead.
- Loading branch information
Showing
8 changed files
with
47 additions
and
51 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export type Direction = "horizontal" | "vertical"; | ||
|
||
export type ResizeEvent = KeyboardEvent | MouseEvent | TouchEvent; | ||
// The "contextmenu" event is not supported as a PointerEvent in all browsers yet, so MouseEvent still need to be handled | ||
export type ResizeEvent = KeyboardEvent | PointerEvent | MouseEvent; | ||
export type ResizeHandler = (event: ResizeEvent) => void; |
19 changes: 9 additions & 10 deletions
19
packages/react-resizable-panels/src/utils/events/getResizeEventCoordinates.ts
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