'Reacting/listening on native browser's datepicker closing

Is there a way to listen on the browser's native datepicker opening/closing?

I have a button which displays data, when clicked it turns into an input with type datetime-local (wrapped in MUIs TextField), it has this calendar icon that when clicked opens a native browser's datepicker popover. Now what I want to do is to know when that datepicker popover is being closed, so that I can turn the input back into a button.

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source