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

[DropdownMenu][ContextMenu][Menu] Only register a single set of event listeners for the entire document #3172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mleibman-db
Copy link

Description

Make Menu components more efficient when used in large numbers by only registering a single set of event listeners on the document to track whether a user is using a keyboard or a mouse.

This properly fixes #1239 and #1139.

I also saw that a similar change was attempted in #1252, but I'm proposing a much simpler implementation here.

P.S. I did read through the discussion in #1239, but we unfortunately do seem to be running into some performance issues due to having a huge number of React components including Menus on the page. While I agree that this is an issue in and of itself, I also think that it's great for UI libraries to be efficient and be able to scale well with a large number of component instances.

when tracking whether a keyboard or a mouse is being used.
@mleibman-db
Copy link
Author

Friendly ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Menu] Each Menu adds its own document event listeners for detecting keyboard state
1 participant