Skip to content

[NavigationMenu] add delay duration skip delay duration props #1478

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

Conversation

akevinge
Copy link
Contributor

@akevinge akevinge commented Jun 18, 2022

Closes #1457

@akevinge akevinge changed the title Navigationmenu add delay duration skip delay duration props [NavigationMenu] add delay duration skip delay duration props Jun 18, 2022
@benoitgrelard
Copy link
Contributor

Not sure what's going on here, but it seems the CI checks haven't run and I don't have the usual button to allow them to run.
You might need to force push or add a new commit or something to trigger it again.

✌️

@akevinge
Copy link
Contributor Author

akevinge commented Aug 29, 2022

Here's to hoping you can run the workflows now. Let me know if something is wrong.

I just want to take a moment to say that I love this project and the work you guys are doing. Would definitely try to contribute more if my college workload wasn't killer.

❤️

Copy link
Contributor

@benoitgrelard benoitgrelard left a comment

Choose a reason for hiding this comment

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

Hey @innub,

Thanks so much for working on this!
Let me know if the feedback makes sense.

@@ -28,6 +28,7 @@ type Direction = 'ltr' | 'rtl';
* -----------------------------------------------------------------------------------------------*/

const NAVIGATION_MENU_NAME = 'NavigationMenu';
const DEFAULT_DELAY_DURATION = 700;
Copy link
Contributor

Choose a reason for hiding this comment

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

Whilst 700 feels right to me for Tooltip, it feels too long for NavigationMenu in my opinion.
How do you feel about this @andy-hook?

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, it definitely feels too long here. It may take some testing to get a good "feel" but something around the 100 mark could be a place to start. If we're too slow here it will exacerbate the issue of users thinking it's a click interaction and immediately closing the menu.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we're too slow here it will exacerbate the issue of users thinking it's a click interaction and immediately closing the menu.

Yes, that's exactly what I thought too.

@@ -0,0 +1,5 @@
releases:
"@radix-ui/react-navigation-menu": patch
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably be tagged as a minor because it introduces a new feature, but also because the out of the box behaviour is "slightly" altered (slight delay by default).

Comment on lines +213 to +214
delayDuration = DEFAULT_DELAY_DURATION,
skipDelayDuration = 300,
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer seeing the defaults being applied at the props level in the components, rather than on the provider.
I know this means multiple places but I think it's better that way so we can always assume a value internally anywhere.

@@ -208,9 +223,16 @@ const NavigationMenuProvider: React.FC<NavigationMenuProviderProps> = (
onChange: onValueChange,
defaultProp: defaultValue,
});
const [shouldSkipDelay, setShouldSkipDelay] = React.useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good if we could follow what was done in Tooltip for consistency purpose.
We track rather whether open should be delayed or not with then a separate handleOpen and handleDelayedOpen.
If we could stay as close as possible to this implementation that would be great 🙏

@benoitgrelard benoitgrelard added the PR: In Review This PR is in the process of being reviewed by the team label Sep 29, 2022
@andy-hook
Copy link
Contributor

I've addressed this feedback plus other issues I noticed via #1716 so will close this in favour.

Thanks again for your efforts and contributions to Radix @innub , much appreciated.

@andy-hook andy-hook closed this Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: In Review This PR is in the process of being reviewed by the team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[NavigationMenu] Add delayDuration and skipDelayDuration props
3 participants