Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateRangePicker shortcuts incorrectly dismiss popovers #3338

Closed
mjbcopland opened this issue Feb 5, 2019 · 4 comments · Fixed by #5219
Closed

DateRangePicker shortcuts incorrectly dismiss popovers #3338

mjbcopland opened this issue Feb 5, 2019 · 4 comments · Fixed by #5219

Comments

@mjbcopland
Copy link

Environment

  • Package: Datetime 3.7.0
  • Browser: Chrome 71.0.3578.98
  • OS: macOS 10.14

Steps to reproduce

  1. Put a DateRangePicker with shortcuts inside a Popover
  2. Click one of the shortcuts

Example

https://blueprintjs.com/docs/#datetime/daterangeinput

Actual behaviour

Popover is dismissed

Expected behaviour

Popover should not be dismissed

Possible solution

Use shouldDismissPopover instead of Classes.POPOVER_DISMISS_OVERRIDE.

@adidahiya
Copy link
Contributor

I don't fully understand, can you post a video / gif of the problem and some example code? In the example you linked, the popover does not get dismissed unless you enable the "close on selection" switch.

@adidahiya
Copy link
Contributor

I looked at this more closely through #3668 and I see the OP issue where the popover is dismissed by the POPOVER_DISMISS class and then immediately re-opened by DateRangeInput's controlled setting of <Popover isOpen>. This is a bug.

@adidahiya adidahiya added the P2 label Aug 26, 2019
@apbarratt
Copy link

Hi people! I've thrown together a sandbox to demonstrate how the date range picker closes any enclosing popover when a shortcut date is selected. Hope this helps towards finding a fix :)
https://codesandbox.io/embed/blueprint-sandbox-zmnow

@SaenkoM
Copy link

SaenkoM commented Apr 2, 2020

As a quick workaround:

const removePopoverDismiss= () => {
  const shortcuts = document.querySelectorAll('.bp3-daterangepicker-shortcuts li .bp3-menu-item')

  shortcuts.forEach((shortcut) => {
    shortcut.classList.remove('bp3-popover-dismiss')
  })
}

popoverProps={{
  ...
  onOpened: removePopoverDismiss,
}}

have to also remove a class on each range change because it is getting added back on shortcut select

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment