arqex / react-datetime

A lightweight but complete datetime picker react component.
2k stars 869 forks source link

Datetime auto-opening on Webkit/Safari #870

Open albatross36 opened 5 months ago

albatross36 commented 5 months ago

I'm Submitting a ...

[x] Bug report
[ ] Feature request
[ ] Support request

Steps to Reproduce

  1. Open Safari (I'm using version 17.5)
  2. Instantiate a <Datetime/> with open={undefined}, inputProps={{someProps}}, renderInput={someJsx}, specifically not specifying the input prop.
  3. See that the input is focused and the date picker menu is open

Expected Results

That the menu starts closed when open={undefined}

Actual Results

The menu is open

Minimal Reproduction of the Problem

Couldn't seem to get the codepen to work.

Other Information (e.g. stacktraces, related issues, suggestions how to fix)

I can see the default open state is being set in DateTime#getInitialState to open: !props.input, which does not consider the open prop. I would expect the default open state to just be open: props.open

noxxxxxxxx commented 2 months ago

@albatross36 Perhaps you might consider trying out my refactored version; the API remains essentially the same

npm i rc-calendar-picker