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

Disable hover when DatePicker does not have focus #483

Merged
merged 2 commits into from
May 10, 2017

Conversation

chris-verclytte
Copy link
Contributor

Adresses #479.

Usefull for DatePicker "resetting" focusedInput when clicking outside of the component.
It avoids DatePicker from showing hover style on day when hovered if the DayPicker does not have
focus.

Copy link
Collaborator

@majapw majapw left a comment

Choose a reason for hiding this comment

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

Just the one change (and maybe a test)?

@@ -642,7 +642,8 @@ export default class DayPickerRangeController extends React.Component {

isHovered(day) {
const { hoverDate } = this.state || {};
return isSameDay(day, hoverDate);
const { focusedInput } = this.props;
return focusedInput && isSameDay(day, hoverDate);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think with the new perf rearchitecture in v11.0.0, we will also have to wrap https://github.com/chris-verclytte/react-dates/blob/c5e7fae7986518dec6cb4e2438d5f0a402d15605/src/components/DayPickerRangeController.jsx#L400-L425 in a if (focusedInput) conditional in this PR.

@coveralls
Copy link

coveralls commented May 10, 2017

Coverage Status

Coverage increased (+0.02%) to 86.526% when pulling 72f3bcd on chris-verclytte:fix/hover-on-blur into f9054d7 on airbnb:master.

@majapw majapw merged commit 774d478 into react-dates:master May 10, 2017
@chris-verclytte
Copy link
Contributor Author

Thanks for this one, I did not found the time to do it this week !

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

Successfully merging this pull request may close these issues.

3 participants