Repository navigation
Conversation
SweetAlert only marked the dialog visible 500ms after opening, and a button press before that fell through to closeModal() without calling the callback. Pressing Enter right away closed a data-request-confirm dialog without resolving or rejecting its request. Mark the dialog visible immediately and ignore presses once it is closing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. WalkthroughSweetAlert now returns from its button event handler when the modal is not visible. The Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to Early confirmation is enabled, and button events are rejected once closing starts. No concrete merge-blocking risk is established. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Early button presses now reach the existing confirmation callback, while presses during closing are ignored. The review found no new request path or confirmed security issue. Risk remains low rather than minimal because authorization and all other confirmation callers were not covered. Retained concerns Security review detailsSecurity Blast Radius
Security Findings and Attack Paths
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I tested this and it seems to work after two tries, not initially. Something is not right. |
|
@mjauvin I think you were still running the old sweet-alert. "Fails the first time, works after that" is exactly how the unpatched code behaves. In the old A likely cause is the browser cache: To test: right after a fresh page load, run this in the console and press Enter as soon as the dialog appears: $.wn.confirm('Test?', function (ok) { console.log('callback:', ok) })It should log |
|
I was not getting the right version of the assets earlier, this works as advertised. Nice work @AIC-BV ! |
|
nice find |

The problem
Pressing Enter right after a backend confirm dialog opens (
data-request-confirm,$.wn.confirm()) doesn't confirm it. The dialog closes and the request is silently dropped.The bundled SweetAlert only adds the
visibleclass 500ms afteropenModal(), which is longer than the 0.3s show animation.onButtonEventonly runs the callback whenvisibleis set. Before that, a press falls through to the finalelse { closeModal(); }, sodoneFunctionis never called. For AJAX confirms,winter.alert.jsthen never resolves or rejects theajaxConfirmMessagepromise, and the request just hangs.Enter counts here because the confirm button is focused when the dialog opens, so Enter is a normal button click.
Changes
openModal()addsvisibleright away instead of after the 500ms timer, so Enter and clicks work during the show animation.onButtonEventreturns early when the dialog isn'tvisible, which now only happens while it's closing. A second press during the close fade used to callcloseModal()a second time; now it's ignored. ThemodalIsVisiblechecks inside the handler were always true after that guard, so I removed them.winter-min.jsis rebuilt withphp artisan winter:util compile js. The other bundles came out with unrelated drift, so I left them out. Compiling from the unchanged source reproduces the committedwinter-min.jsexactly, so its whole diff comes from this change.The delay didn't prevent accidental confirms in practice. The Enter that opens a dialog is handled on keydown before the dialog exists, a held Enter auto-repeats after about 500ms anyway, and the second click of a double-click lands on the overlay, not the OK button.
Testing
In the backend, calling
$.wn.confirm()and pressing Enter 50ms after opening:trueA real Enter keypress confirms. Cancel calls the callback with
falseonce, even with a second click during the close fade.🤖 Generated with Claude Code
Summary by CodeRabbit