Skip to content

Commit 8f13def

Browse files
committed
Refactored clickHandler() event check in chatgpt.alert() for readability
1 parent 2784391 commit 8f13def

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chatgpt.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ const chatgpt = {
229229

230230
// Define click/key handlers
231231
const clickHandler = event => { // explicitly defined to support removal post-dismissal
232-
if (event.target == event.currentTarget || event.target instanceof SVGPathElement) dismissAlert(); };
232+
if (event.target == event.currentTarget || event.target.closest('[class*="-close-btn]')) dismissAlert(); };
233233
const keyHandler = event => { // to dismiss active alert
234234
if (/^(?: |Space|Enter|Return|Esc)/.test(event.key) || [32, 13, 27].includes(event.keyCode)) {
235235
for (const alertId of alertQueue) { // look to handle only if triggering alert is active

0 commit comments

Comments
 (0)