Repository navigation
Keep a dialog open when a file picker inside it is cancelled - #43297
samyferhat wants to merge 2 commits into
Conversation
A file input fires a bubbling `cancel` event when the user dismisses the picker. The dialog handler treated that event as its own, so the dialog closed. Ignore a `cancel` event from a descendant. The dialog's own `cancel` event does not bubble, so Escape still works. Fixes twbs#43278 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The fix is small and the code comment explains well why the target check is safe. Two suggestions for the tests:
|
Check that the dialog does not call preventDefault() on a cancel event from a file input. Also check that Escape still closes the dialog once after the file picker is cancelled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
✅ Deploy Preview for twbs-bootstrap ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Thanks, both are in d8784e8.
Both new tests fail when I revert the fix in |
Description
DialogBase, ignore acancelevent when its target is not the dialog element.keyboard: false, and a drawer. Each test fires a bubblingcancelevent from a file input.Motivation & Context
cancelevent when the user dismisses the picker. The handler treated this event as the dialog's own, so the dialog closed. Withkeyboard: false, it played the static backdrop animation.cancelevent does not bubble, so Escape still works.DialogandDrawerboth use this handler, so the fix applies to both.cancelwithbubbles: true, and the dialog closes.npm run lint,npm run js-test-unit, andnpm run jspass locally.dialog.spec.jsalready exceeded the ESLintmax-lineslimit (1502 of 1500). That warning stays.Type of changes
Checklist
npm run lint)Live previews
Related issues
Fixes #43278
🤖 Generated with Claude Code