• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

react-ui-org / react-ui / 12888195771

21 Jan 2025 01:38PM UTC coverage: 89.883% (-2.1%) from 91.979%
12888195771

Pull #544

github

web-flow
Merge 5776dcbf0 into 684d5abff
Pull Request #544: Re-implement `Modal` component using HTMLDialogElement (#461)

805 of 909 branches covered (88.56%)

Branch coverage included in aggregate %.

45 of 62 new or added lines in 8 files covered. (72.58%)

1 existing line in 1 file now uncovered.

732 of 801 relevant lines covered (91.39%)

71.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

48.0
/src/components/Modal/_helpers/dialogOnClickHandler.js
1
export const dialogOnClickHandler = (
4✔
2
  e,
3
  closeButtonRef,
4
  dialogRef,
5
  allowCloseOnBackdropClick,
6
) => {
7
  // If it is not allowed to close modal on backdrop click, do nothing.
8
  if (!allowCloseOnBackdropClick) {
6!
NEW
9
    return;
×
10
  }
11

12
  // Detection of the click on the backdrop is based on the following conditions:
13
  // 1. The click target is the dialog itself. This prevents detection of clicks on the dialog's children.
14
  // 2. The click is outside the dialog's boundaries.
15
  const dialogRect = dialogRef.current.getBoundingClientRect();
6✔
16
  const isClickedOnBackdrop = dialogRef.current === e.target && (
6!
17
    e.clientX < dialogRect.left
18
    || e.clientX > dialogRect.right
19
    || e.clientY < dialogRect.top
20
    || e.clientY > dialogRect.bottom
21
  );
22

23
  // If user does not click on the backdrop, do nothing.
24
  if (!isClickedOnBackdrop) {
6!
25
    return;
6✔
26
  }
27

28
  // If the close button is not disabled, close the modal.
NEW
29
  if (closeButtonRef?.current != null && closeButtonRef?.current?.disabled === false) {
×
NEW
30
    closeButtonRef.current.click();
×
31
  }
32
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc