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

DatePickerInput type=range popoverProp onClose event prevents it from closing #4105

Closed
fozzarelo opened this issue Apr 19, 2023 · 4 comments
Closed
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@fozzarelo
Copy link

What package has an issue

@mantine/dates

Describe the bug

Dates/DatePickerInput/type=range/popoverProp/onClose event prevents it from closing.

I'm trying to append a footer to the dropDown component. I want to use the onOpen and onClose events in popoverProp to bring my footer about(by triggering a setState)

onOpen works with no issues: triggers then closes
onClose when clicking in the input box it works as expected: triggers and closes
onClose when clicking outside triggers, but the dropdown remains open.

Is this intended functionality?
Can I close it programmatically? Call a close inside the onClose
or can you suggest another workaround?

What version of @mantine/hooks page do you have in package.json?

6.0.4

If possible, please include a link to a codesandbox with the reproduced problem

https://codesandbox.io/s/interesting-sun-qmt8j6?file=/src/App.tsx

Do you know how to fix the issue

No

Are you willing to participate in fixing this issue and create a pull request with the fix

Yes

Possible fix

No response

@fozzarelo fozzarelo changed the title Dates/DatePickerInput/type=range/popoverProp/onClose event prevents it from closing DatePickerInput type=range popoverProp onClose event prevents it from closing Apr 19, 2023
@hassanzohdy
Copy link
Contributor

It seems to me it works fine, put the welcome text outside the InfoBox so outsideClick prop would work as expected.

https://codesandbox.io/s/charming-lovelace-oj94ec

@fozzarelo
Copy link
Author

fozzarelo commented Apr 25, 2023

Hi, thank you @hassanzohdy

Sorry, it seems I kept working on the fork until I hit a solution. Here is a more straightforward reproduction of the bug:

https://codesandbox.io/s/onclosebug-qmt8j6?file=/src/App.tsx

I also found adding the 'opened' prop keeps onOpen from triggering. Here is a reproduction:

https://codesandbox.io/s/opened-onopenbug-txtyzj?file=/src/App.tsx

@fozzarelo
Copy link
Author

The footer is still doable the bugs can be worked around, here goes an example in case someone finds it useful

https://codesandbox.io/s/works-using-click-outside-uj42ek?file=/src/App.tsx

@rtivital rtivital added TBD It is clear how to fix the issue and the fix will be provided soon Needs validation It is not clear whether the issue is not user mistake, validation of the issue is required and removed TBD It is clear how to fix the issue and the fix will be provided soon labels Sep 25, 2023
@rtivital rtivital removed the Needs validation It is not clear whether the issue is not user mistake, validation of the issue is required label Feb 26, 2024
rtivital added a commit that referenced this issue Feb 26, 2024
…nent value in DatePickerInput and other similar components (#4105)
@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Feb 26, 2024
@rtivital
Copy link
Member

Fixed in 7.6.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

3 participants