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

Filter panel key listener fix #158

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ktpa
Copy link
Contributor

@ktpa ktpa commented Jan 10, 2023

Closes #157

@ktpa
Copy link
Contributor Author

ktpa commented Jan 10, 2023

Wait with merging this! Bug still occurs on

  • Source
  • Host
  • Tag

fields.

@ktpa ktpa marked this pull request as draft January 10, 2023 20:21
@ktpa ktpa marked this pull request as ready for review January 12, 2023 07:08
@RuthgerD
Copy link
Collaborator

I would say, this approach is a bit too manual; could we check if there is a focused element with document.activeElement?

@ktpa
Copy link
Contributor Author

ktpa commented Jan 12, 2023

Will take another look at activeElement when I have time.

@ktpa
Copy link
Contributor Author

ktpa commented Jan 12, 2023

I have looked at activeElement and this is a functionality that while it might also work, creates an overhead and duplicate code because we will need to check all future inputs for the same activeElement functionality.

For this reason, it is better to incorporate the functionality as it is now because it means that every time we use the TextField component, the App automatically gets the dispatched onFocus and onBlur functionality. This means that we do not duplicate code and also have less code to do the same thing in the long run.

Tell me what you think again.

@RuthgerD
Copy link
Collaborator

If you check if anything is focused (except the graph itself) then you can ignore keyboard inputs, not sure what you mean by it introducing overhead / duplicate code when the goal is to only have a single check for everything.

@ktpa
Copy link
Contributor Author

ktpa commented Jan 13, 2023

If you check if anything is focused (except the graph itself) then you can ignore keyboard inputs, not sure what you mean by it introducing overhead / duplicate code when the goal is to only have a single check for everything.

I'll have to retract my previous statement, you are indeed correct. However - if all text fields used the TextField component then this solution would be just as effective as activeElement. Shouldn't this be encouraged, in order to limit the amount of custom code since just using the native input probably means more fiddling with those specific areas in the code?

If I could choose I would probably make sure that every text field is of the TextField component and listen to it as it is implemented in this PR. Would you still like the refactor to activeElement instead?

@RuthgerD
Copy link
Collaborator

Sorry I ignored my notifcations for a bit, but my stance is still the same; while reusing components is good we should also reuse the facilities the browser already gives us, like focus management.

Also I dont want to maintain this kind of pattern in the future, when adding new things that need focus this will keep popping up.

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.

Bug: Filter panel input listens to keybinds
3 participants