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

Tabbing out of Menu does not close the menu [preact] #98

Closed
ryan-codingintrigue opened this issue Jul 25, 2019 · 5 comments
Closed

Tabbing out of Menu does not close the menu [preact] #98

ryan-codingintrigue opened this issue Jul 25, 2019 · 5 comments

Comments

@ryan-codingintrigue
Copy link

ryan-codingintrigue commented Jul 25, 2019

When using preact rather than standard React, the closeOnBlur method does not fire correctly unless the focus is on the role="menu" element directly.

I think this is due to preactjs/preact#872.

If we change:

menuProps.onBlur = ambManager.handleBlur;

To use onFocusOut instead which, according to facebook/react#6410 does bubble:

menuProps.onFocusOut = ambManager.handleBlur;

The functionality works as expected.

Is this worth a PR? I think it should work for both Preact & React.

@shirshendubhowmick
Copy link
Collaborator

shirshendubhowmick commented Jul 25, 2019

@ryan-codingintrigue I personally haven't tried with preact yet. I will have to try that out once. However can you raise a PR ?

@ryan-codingintrigue
Copy link
Author

@shirshendubhowmick Thanks! Generally preact is a 1-1 replacement for React, but there are a few edge cases.

This isn't a problem with this library as such, but changing the code here is the only way to get this to work with Preact 😦

@shirshendubhowmick
Copy link
Collaborator

Allow me some time to review this out.

@vutran
Copy link
Contributor

vutran commented Sep 21, 2019

It seems like the fix needs to happen on the preact-compat layer instead so that it's emulated 1:1 instead of a workaround in this library.

@ryan-codingintrigue
Copy link
Author

@vutran That is a discussion for sure. I linked the issue in the PR which discusses that. Their response is that they won’t do that unless it is required by a “popular” library 🤔

I took a while to finish the PR because we’ve moved to React too to try and avoid these issues so I am happy to close it and leave it just for reference purposes. If someone down the line needs it we could re-open

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

No branches or pull requests

3 participants