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
topology: add delay to setting hover states #3584
topology: add delay to setting hover states #3584
Conversation
76146cd
to
919ba31
Compare
@jeff-phillips-18 So the idea is to just add a hover out delay for the connector? Because we still need a configurable delay for hover in. |
919ba31
to
bd87152
Compare
@christianvogt The delay is for both in and out, and it is configurable. Didn't think we needed it to be configurable separately for the two as it acts a bit strange when you do that (two nodes highlighted briefly). |
delayHandle = clearTimeout(unsetHandle.current); | ||
setHover(true); | ||
}, delay); | ||
clearTimeout(unsetHandle.current); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trying to recall why this is inside the timeout and not outside. However by you clearing the timeout above, we don't need this here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is needed if the timer is created during the hover delay, not needed below when there is no delay.
}, delay); | ||
clearTimeout(unsetHandle.current); | ||
setHover(newState); | ||
}, timeoutDelay); | ||
} else { | ||
clearTimeout(unsetHandle.current); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is redundant with line 30.
@@ -49,18 +56,19 @@ const useHover = <T extends Element>( | |||
node.removeEventListener('mouseenter', onMouseEnter); | |||
node.removeEventListener('mouseleave', onMouseLeave); | |||
clearTimeout(delayHandle); | |||
delayHandle = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't needed.
@@ -6,6 +6,7 @@ const useHover = <T extends Element>( | |||
): [boolean, (node: T) => (() => void) | undefined] => { | |||
const [hover, setHover] = React.useState<boolean>(false); | |||
const unmountRef = React.useRef(false); | |||
const timeoutDelay = delay !== undefined ? delay : 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use a default value in the param
delay? = 200,
I'd like to see both a separate delayIn
and delayOut
but we can add as needed in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added them
Addresses usability issue trying to create a new connection.
bd87152
to
d51e2c5
Compare
/retest |
1 similar comment
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: christianvogt, jeff-phillips-18 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
3 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Addresses usability issue trying to create a new connection.
Resolves https://jira.coreos.com/browse/ODC-2210