Skip to content

Commit

Permalink
fix(cdk): provided double value is non-finite (#8161)
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode authored Jul 20, 2024
1 parent 95b57e0 commit 276879b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion projects/cdk/utils/focus/set-native-mouse-focused.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ export function tuiSetNativeMouseFocused(
}

if (typeof Event === 'function') {
element.dispatchEvent(new Event('mousedown', {bubbles: true, cancelable: true}));
element.dispatchEvent(
new MouseEvent('mousedown', {
bubbles: true,
cancelable: true,
}),
);
} else {
const event = element.ownerDocument.createEvent('Event');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('tuiSetNativeMouseFocused', () => {
tuiSetNativeMouseFocused(element);

expect(mockDispatchEvent).toHaveBeenCalledWith(
new Event('mousedown', {bubbles: true, cancelable: true}),
new MouseEvent('mousedown', {bubbles: true, cancelable: true}),
);
});

Expand Down

0 comments on commit 276879b

Please sign in to comment.