@turnit-ou/shared 2.18.2 → 2.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -68,9 +68,9 @@ export function DrawerForm(inProps) {
68
68
  const handleClickClose = useCallback((event) => {
69
69
  onClose?.(event, 'close');
70
70
  }, [onClose]);
71
- // MUI's ClickAwayListener only skips the click that mounted it. This one
72
- // stays mounted while closed, so the click that opens the drawer would also
73
- // reach it as a click outside and close the drawer straight away.
71
+ // MUI's ClickAwayListener only skips the event that mounted it. This one
72
+ // stays mounted while closed, so a drawer opened from a mouseup handler
73
+ // would receive that same mouseup as an outside click and close straight away.
74
74
  const clickAwayArmedRef = useRef(false);
75
75
  useEffect(() => {
76
76
  if (!open) {
@@ -85,7 +85,8 @@ export function DrawerForm(inProps) {
85
85
  };
86
86
  }, [open]);
87
87
  const handleClickAway = useCallback((event) => {
88
- if (clickAwayArmedRef.current) {
88
+ const isNonPrimaryButton = 'button' in event && event.button !== 0;
89
+ if (clickAwayArmedRef.current && !isNonPrimaryButton) {
89
90
  onClose?.(event, 'backdropClick');
90
91
  }
91
92
  }, [onClose]);
@@ -96,7 +97,7 @@ export function DrawerForm(inProps) {
96
97
  // why MUI's own aria-hidden is not enough here).
97
98
  const drawerRef = useRef(null);
98
99
  useInertBackground(Boolean(open), drawerRef);
99
- return (_jsx(ClickAwayListener, { onClickAway: handleClickAway, children: _jsx(Drawer, { ref: drawerRef, anchor: "right", open: open, onClose: onClose, className: classNames(classes.modal, className), disablePortal: true, hideBackdrop: true, PaperProps: {
100
+ return (_jsx(ClickAwayListener, { mouseEvent: "onMouseUp", onClickAway: handleClickAway, children: _jsx(Drawer, { ref: drawerRef, anchor: "right", open: open, onClose: onClose, className: classNames(classes.modal, className), disablePortal: true, hideBackdrop: true, PaperProps: {
100
101
  className: classes.paper,
101
102
  elevation: 4,
102
103
  square: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turnit-ou/shared",
3
- "version": "2.18.2",
3
+ "version": "2.18.3",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "start": "vite --force",