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

Remove popover dismiss class from DateRangePicker shortcuts #3339

Conversation

mjbcopland
Copy link

Fixes #3338

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

Correctly prevent DateRangePicker shortcuts from dismissing popovers

Reviewers should focus on:

Shortcuts are implemented using MenuItems, which receive the POPOVER_DISMISS class by default. In order to prevent this behaviour, DateRangePicker adds the POPOVER_DISMISS_OVERRIDE class. However, when an element has both classes, the former takes priority and the override has no effect. This change uses the shouldDismissPopover prop of MenuItem to achieve the desired behaviour.

Screenshot

N/A

@palantirtech
Copy link
Member

Thanks for your interest in palantir/blueprint, @mjbcopland! Before we can accept your pull request, you need to sign our contributor license agreement - just visit https://cla.palantir.com/ and follow the instructions. Once you sign, I'll automatically update this pull request.

Copy link
Contributor

@giladgray giladgray left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mjbcopland thanks for the PR! please change this so the dismiss class is only applied if closeOnSelection={true}

@@ -46,7 +46,7 @@ export class Shortcuts extends React.PureComponent<IShortcutsProps> {

const shortcutElements = shortcuts.map((s, i) => (
<MenuItem
className={Classes.POPOVER_DISMISS_OVERRIDE}
shouldDismissPopover={false}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mm it's not entirely this simple. can we actually make this value correspond to the closeOnSelection prop?
so if you enable that prop then clicking shortcuts will close, otherwise they won't.

@@ -1169,6 +1169,11 @@ describe("<DateRangePicker>", () => {
assert.equal(onChangeSpy.firstCall.args[0][0] as Date, startTime);
});

it("shortcuts do not dismiss popovers", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's test that this feature is tied to closeOnSelection

@giladgray
Copy link
Contributor

@mjbcopland also please sign the CLA 😄 i cannot merge until you accept it.

@adidahiya
Copy link
Contributor

@mjbcopland are you able to sign the CLA?

@Yonben
Copy link

Yonben commented Jul 17, 2019

What could we do to get that fix in if the original writer doesn't sign? Could I fork and do it again?

@adidahiya
Copy link
Contributor

@Yonben yes you can open a new PR

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

Successfully merging this pull request may close these issues.

DateRangePicker shortcuts incorrectly dismiss popovers
5 participants