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

topology: add delay to setting hover states #3584

Merged

Conversation

jeff-phillips-18
Copy link
Member

Addresses usability issue trying to create a new connection.

Resolves https://jira.coreos.com/browse/ODC-2210

@openshift-ci-robot openshift-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. component/dev-console Related to dev-console labels Nov 26, 2019
@christianvogt
Copy link
Contributor

@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.

@openshift-ci-robot openshift-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Nov 26, 2019
@jeff-phillips-18
Copy link
Member Author

@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);
Copy link
Contributor

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.

Copy link
Member Author

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);
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

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.

Copy link
Member Author

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.
@jeff-phillips-18
Copy link
Member Author

/retest

1 similar comment
@jeff-phillips-18
Copy link
Member Author

/retest

@christianvogt
Copy link
Contributor

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 4, 2019
@openshift-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 4, 2019
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit effde1d into openshift:master Dec 5, 2019
@spadgett spadgett added this to the v4.4 milestone Dec 9, 2019
@jeff-phillips-18 jeff-phillips-18 deleted the topology-hover branch December 2, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/dev-console Related to dev-console lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants