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

Clicking on "input group", but not in an input, does nothing. #114

Closed
baleeds opened this issue Nov 2, 2018 · 4 comments
Closed

Clicking on "input group", but not in an input, does nothing. #114

baleeds opened this issue Nov 2, 2018 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@baleeds
Copy link

baleeds commented Nov 2, 2018

It seems to me that the UX would greatly improved if there were some reaction when clicking in the styled 'input' area, marked by the class "react-date-picker__button__input". This is very evident when inputs are taking the whole width:

image

My expectation is that clicking in that area would focus the first text input.

@nkurapati
Copy link

nkurapati commented Nov 12, 2018

Small work around

.react-date-picker__inputGroup__year { flex-grow: 1; } }

@wojtekmaj
Copy link
Owner

Yeah that seems like a neat idea. It's what native input does by default when expanded beyond what's necessary, and React-Date-Picker's aim is to behave as closely to a native input as possible. This will be out with the next release of React-Date-Picker, React-DateTime-Picker, React-Time-Picker and their range versions, too.

@wojtekmaj wojtekmaj self-assigned this Nov 12, 2018
@wojtekmaj wojtekmaj added the enhancement New feature or request label Nov 12, 2018
@wojtekmaj wojtekmaj added this to the 7.0.0 milestone Nov 12, 2018
@baleeds
Copy link
Author

baleeds commented Nov 12, 2018

Looking forward to it! Thanks for all your work!

@htmlboy
Copy link

htmlboy commented Sep 3, 2019

Hi, I'm adding this note for future reference, since I found a workaround for this issue.

You can create a state for isOpen and change it by clicking on the DatePicker component. The isOpenprop only affects the component when the value change, so it doesn't override other behaviours, like clicking out. BUT for the same reason, you should update the state when the calendar is closed, or it will only work once.

Here's my code.

Before render():

constructor() {
    super();
    this.state = {
      isOpen: false,
    };
    this.openCal = this.openCal.bind(this);
    this.closeCal = this.closeCal.bind(this);
  }

  openCal() {
    this.setState({ isOpen: true });
  }

  closeCal() {
    this.setState({ isOpen: false });
  }

On the DatePicker component:

<DatePicker
          onCalendarClose={this.closeCal}
          onClick={this.openCal}
          isOpen={this.state.isOpen}
          …
/>

(Potential workaround for #120 #67 and related to #59)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants