fix: prevent Modal from closing when dismissing DateRangePicker via outside click#9505
fix: prevent Modal from closing when dismissing DateRangePicker via outside click#9505reidbarber merged 3 commits intoadobe:mainfrom
Conversation
snowystinger
left a comment
There was a problem hiding this comment.
Thanks for the PR, can you provide a summary of the changes you made and how it solves the problem. I'm having a little trouble understanding how this will always have something to close.
Are we able to write a unit test for this? That could help as well.
| </DatePicker> | ||
| ); | ||
|
|
||
| export const DateRangePickerExample: DateRangePickerStory = (args) => ( |
There was a problem hiding this comment.
Ah, usually I split them into two functions then, one that's the story and the other is the shareable implementation
| }; | ||
|
|
||
| let onInteractOutsideStart = (e: PointerEvent) => { | ||
| const topMostOverlay = (lastVisibleOverlay.current = visibleOverlays[visibleOverlays.length - 1]); |
There was a problem hiding this comment.
| const topMostOverlay = (lastVisibleOverlay.current = visibleOverlays[visibleOverlays.length - 1]); | |
| const topMostOverlay = visibleOverlays[visibleOverlays.length - 1] | |
| lastVisibleOverlay.current = topMostOverlay; |
Makes it easier to read that there are two assignments
|
@snowystinger Do you remember issue #7887? I think it has the same root cause as this one. The problem is that A simple fix would be to only call |
snowystinger
left a comment
There was a problem hiding this comment.
@snowystinger Do you remember issue #7887? I think it has the same root cause as this one.
Great call out, I'd forgotten about that one. Thanks.
Also, thanks for writing a test for it and including some more info in the comment. I think the fix makes sense.
Closes #9469
✅ Pull Request Checklist:
📝 Test Instructions:
Go to DateRangePickerInsideModal story
Open the Modal, then open the DateRangePicker and select a start date. Clicking outside the Modal should close the picker but keep the Modal open.
🧢 Your Project: