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

text input field focus should deactivate shortcuts #6051

Open
mxcrbn opened this issue Jun 27, 2024 · 1 comment
Open

text input field focus should deactivate shortcuts #6051

mxcrbn opened this issue Jun 27, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@mxcrbn
Copy link

mxcrbn commented Jun 27, 2024

Bug Description

typing specific characters (eg "g") in a text field triggers shortcuts

Example:

i was trying to add a stage in opportunities ("Contacting") but can't type the "g" + if I type eg "t" after typing "g", i'm redirected to that tasks screen

screen:
https://github.com/twentyhq/twenty/assets/53276986/b038280b-ac0a-42c1-a6fa-122f3cd6d203

Expected behavior

i can type my text without triggering shortcuts when focus is on text input field / can trigger shortcuts when no focus is on text input field

@mxcrbn mxcrbn added the type: bug Something isn't working label Jun 27, 2024
Copy link

greptile-apps bot commented Jun 27, 2024

To resolve the issue where typing in a text input field triggers shortcuts, follow these steps:

  1. Locate the TextInput component: This is likely where the focus handling should be adjusted.

  2. Modify the TextInput component to set the hotkey scope when the input field is focused. You can use the InputHotkeyScope enum to manage this.

  3. Example Code:

import { InputHotkeyScope } from 'path/to/InputHotkeyScope';

class TextInput extends React.Component {
  handleFocus = () => {
    // Set the hotkey scope to deactivate shortcuts
    InputHotkeyScope.setScope('textInput');
  };

  handleBlur = () => {
    // Revert the hotkey scope to its previous state
    InputHotkeyScope.revertScope();
  };

  render() {
    return (
      <input
        type="text"
        onFocus={this.handleFocus}
        onBlur={this.handleBlur}
        {...this.props}
      />
    );
  }
}
  1. Ensure InputHotkeyScope is properly implemented to manage the scope stack and deactivate shortcuts when the scope is set to textInput.

This should prevent shortcuts from being triggered when typing in a text input field.

Edit Issue Bot Settings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working
Projects
Status: 🆕 New
Development

No branches or pull requests

1 participant