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

feat: don't allow dropdown navigation on input focused #9341

Merged
merged 3 commits into from
May 2, 2024

Conversation

scmmishra
Copy link
Member

@scmmishra scmmishra commented May 2, 2024

Fixes https://linear.app/chatwoot/issue/CW-3266/i-cannot-click-up-or-down-arrow-buttons-in-the-editor

In #9242 we refactored keyboard shortcuts to use a declarative approach, using tinykeys as the base.

There was another change in the PR that allowed these shortcuts to run even when the input was triggered. To enable this behaviour, we had to prevent default in multiple places, this was because running these shortcuts like Alt+O for example would render associated ASCII characters with it.
In order to prevent that we added preventDefault to the keyboard event. In this case, the keyboard event was added to the ArrowUp and ArrowDown handler. This overrode the default action inside the editor. This PR fixes this


Future Work

  • Ideally, navigation a list within the component should not be attached to the document object, we need to update the mixin to allow arbitrary targets within the component.
  • We can automatically prevent default if allowOnFocusedInput is set to true and the keys pressed with any modifiers, for the rest we can let the event continue to propagate and trigger default as well.

@scmmishra scmmishra changed the title feat: don't allow dropdown navigation on input feat: don't allow dropdown navigation on input focused May 2, 2024
Copy link
Member

@iamsivin iamsivin left a comment

Choose a reason for hiding this comment

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

Tested the PR. And it's working fine.

@iamsivin iamsivin temporarily deployed to chatwoot-pr-9341 May 2, 2024 15:19 Inactive
Copy link

linear bot commented May 2, 2024

@iamsivin iamsivin merged commit 7f8ac37 into develop May 2, 2024
13 of 14 checks passed
@iamsivin iamsivin deleted the fix/shortcuts-1 branch May 2, 2024 15:39
Copy link

github-actions bot commented Jun 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants