mirror of
https://github.com/wassname/talk.git
synced 2026-07-27 11:28:12 +08:00
fix: select not propagating value in ff
This commit is contained in:
@@ -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() {
|
||||
|
||||
@@ -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 });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user