fix: select not propagating value in ff

This commit is contained in:
Chi Vinh Le
2018-10-19 20:20:38 +02:00
parent a3aca825e3
commit 544c21440b
2 changed files with 6 additions and 6 deletions
@@ -19,9 +19,9 @@ const withKeyboardFocus: DefaultingInferableComponentEnhancer<
> = hoistStatics<InjectedProps>(
<T extends InjectedProps>(BaseComponent: React.ComponentType<T>) => {
class WithKeyboardFocus extends React.Component<any> {
private lastMouseDownTime: number = 0;
public state = {
keyboardFocus: false,
lastMouseDownTime: 0,
};
private handleFocus: React.EventHandler<FocusEvent<any>> = event => {
@@ -29,7 +29,7 @@ const withKeyboardFocus: DefaultingInferableComponentEnhancer<
this.props.onFocus(event);
}
const now = new Date().getTime();
if (now - this.state.lastMouseDownTime > 750) {
if (now - this.lastMouseDownTime > 750) {
this.setState({ keyboardFocus: true });
}
};
@@ -45,7 +45,7 @@ const withKeyboardFocus: DefaultingInferableComponentEnhancer<
if (this.props.onMouseDown) {
this.props.onMouseDown(event);
}
this.setState({ lastMouseDownTime: new Date().getTime() });
this.lastMouseDownTime = new Date().getTime();
};
public render() {
+3 -3
View File
@@ -19,16 +19,16 @@ const withMouseHover: DefaultingInferableComponentEnhancer<
> = hoistStatics<InjectedProps>(
<T extends InjectedProps>(BaseComponent: React.ComponentType<T>) => {
class WithMouseHover extends React.Component<InjectedProps> {
private lastTouchEndTime = 0;
public state = {
mouseHover: false,
lastTouchEndTime: 0,
};
private handleTouchEnd: React.EventHandler<TouchEvent<any>> = event => {
if (this.props.onTouchEnd) {
this.props.onTouchEnd(event);
}
this.setState({ lastTouchEndTime: new Date().getTime() });
this.lastTouchEndTime = new Date().getTime();
};
private handleMouseOver: React.EventHandler<MouseEvent<any>> = event => {
@@ -36,7 +36,7 @@ const withMouseHover: DefaultingInferableComponentEnhancer<
this.props.onMouseOver(event);
}
const now = new Date().getTime();
if (now - this.state.lastTouchEndTime > 750) {
if (now - this.lastTouchEndTime > 750) {
this.setState({ mouseHover: true });
}
};