Conversation
|
|
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: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe dialog now applies live ChangesDynamic dialog dismissal options
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to Live dismissal settings are applied when dialogs open and change, and no introduced positioning regression was found. The PR is ready for normal merge checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The changes are confined to dialog behavior. Dismissal remains subject to the configured controls, but applications that specify both an attachment target and an origin may see different positioning and outside-click behavior. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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 |
0f6600e to
3295fa7
Compare
`BrnDialogRef.dismiss()` read `disableClose` and `closeOnOutsidePointerEvents` from the options snapshot taken when the dialog opened, so a binding such as `[disableClose]="form.dirty()"` that changed afterwards was ignored: Escape and backdrop clicks still dismissed the dialog and discarded the user's edits, and a dialog opened with `disableClose` on could never be dismissed. `panelClass` and `overlayClass` already forward live updates to the open ref; `disableClose` was the odd one out. Forward both inputs to the open ref through effects, mirroring the existing panel/overlay class sync, and read them at dismiss time. Programmatic `close()` is unaffected. Closes spartan-ng#1682
3295fa7 to
b1b43d1
Compare
PR Checklist
Please check if your PR fulfills the following requirements:
guidelines: https://github.com/spartan-ng/spartan/blob/main/CONTRIBUTING.md#-commit-message-guidelines
PR Type
What kind of change does this PR introduce?
Which package are you modifying?
Primitives
Others
What is the current behavior?
Closes #1682
BrnDialog.open()passes_options()by value toBrnDialogService.open(), andBrnDialogRef.dismiss()readsdisableCloseandcloseOnOutsidePointerEventsfrom that frozeninitialOptionssnapshot. Changes to the[disableClose]binding while the dialog is open never reach the ref, so:<hlm-sheet [disableClose]="form.dirty()">opened pristine capturesfalse; once the user edits the form, Escape or a backdrop click still dismisses the sheet and silently discards the edits.disableClosetruecan never be dismissed by the user, even after the binding turnsfalse.This is a regression of #882 (fixed in #1203 via
updateOptions()), reintroduced when the June dialog/overlay lifecycle rework replaced that mechanism withdismiss()+initialOptions.panelClassandoverlayClassalready forward live updates to the open ref throughsetPanelClass/setOverlayClass;disableClosewas the odd one out.What is the new behavior?
BrnDialogRefkeepsdisableCloseandcloseOnOutsidePointerEventsas mutable state (seeded from the open-time options) and exposessetDisableClose()/setCloseOnOutsidePointerEvents().dismiss()reads that state at dismiss time.BrnDialogforwards both signal inputs to the open ref through effects (_syncDisableClose,_syncCloseOnOutsidePointerEvents), mirroring the existing_syncPanelClass/_syncOverlayClass.BrnSheetandBrnAlertDialoginherit the fix.close()andbrnDialogClosebuttons are unaffected, as before.Regression coverage in
libs/brain/dialog/src/lib/brn-dialog.spec.ts(real-browser vitest, like the other brain specs):disableCloseturns on after open, and work again once it turns off.disableCloseturns off after opening with it on.closeOnOutsidePointerEventschange after open is honoured for backdrop clicks while Escape still closes.close()still works whiledisableCloseis on.The first four specs fail on current
main(they see the stale snapshot) and pass with this change.Does this PR introduce a breaking change?
Other information
disableClose/closeOnOutsidePointerEventsas live inputs; this PR makes that true while the dialog is open.BrnOverlayRef.dismiss()(popover, tooltip, hover-card) reads itsinitialOptionsthe same way, so[disableClose]on those primitives has the same limitation. Left out of this PR to keep it scoped to Dialog: disableClose is snapshotted at open() - dynamic updates ignored (regression of #882, previously fixed by #1203) #1682; happy to follow up if you want the overlay primitive aligned too.pnpm nx format:check --base=origin/main,pnpm nx affected -t lint,pnpm nx run-many -t test -p brain helm,pnpm nx run-many -t build -p brain helm.Summary by CodeRabbit
New Features
Bug Fixes