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

Add support for keyboard navigation #73

Merged
merged 2 commits into from
Feb 2, 2024

Conversation

LaChope
Copy link
Contributor

@LaChope LaChope commented Feb 1, 2024

@ledsoft This PR aims to solve kbss-cvut/s-forms#258

@@ -352,10 +352,14 @@ const Menu = (props) => {
props.selectProps.listProps.onScroll(e.target);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@ledsoft It does not seem to be used anywhere, are there scenarios where it is needed? It seems like the component works better without this custom Menu component

Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you be more specific as to what you mean by "works better"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without custom Menu, expected behavior is working as intended (i.e. keyboard navigation enabled, no scroll to top when clicking). With the custom Menu, I had to implement onMouseEnter to enable keyboard navigation (does not work with onMouseDown)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok, in that case why don't you go ahead and remove the custom Menu component altogether. It was added there just to fix some scrolling issues, maybe that is no longer necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I was just concerned it is here for other cases I'm not aware of but yes then I'll remove it.

@@ -352,10 +352,14 @@ const Menu = (props) => {
props.selectProps.listProps.onScroll(e.target);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you be more specific as to what you mean by "works better"?

@@ -352,10 +352,14 @@ const Menu = (props) => {
props.selectProps.listProps.onScroll(e.target);
},
//Enables option selection even when input is not focused
onMouseDown: (event) => {
onMouseEnter: (event) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Isn't this a bit too eager? Mouse enter will trigger focus whenever mouse enters the menu list, which could mean it will steal focus from other components accidentally. How does this help with the keyboard navigation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I agree that it is quite eager, if you think it makes sense I would remove this custom Menu (see reply above), otherwise I will think about another implementation.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's remove the component in that case.

@ledsoft
Copy link
Collaborator

ledsoft commented Feb 2, 2024

@LaChope Could you check that your code is synchronized with the base? I see conflicts in VirtualizedTreeSelect.

@LaChope
Copy link
Contributor Author

LaChope commented Feb 2, 2024

@ledsoft Yes I see, the issue comes from that I did not synchronize with this: #71, but I remember you do not wish to leave it in main?

@ledsoft
Copy link
Collaborator

ledsoft commented Feb 2, 2024

So we should revert #71? Will the component work in s-forms with React 18 without it? That was, I believe, the reason the PR was originally created...

@LaChope
Copy link
Contributor Author

LaChope commented Feb 2, 2024

Yes it can be reverted, in the end this issue was solved with a simpler fix here: kbss-cvut/s-forms#232 (using intelligent-tree v0.11.1)

@ledsoft ledsoft merged commit d633c6b into lecbyjak:master Feb 2, 2024
@ledsoft
Copy link
Collaborator

ledsoft commented Feb 2, 2024

@LaChope Ok, merged and published as 0.11.2.

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.

2 participants