Skip to content

[Feature] Autofocus on text input area when activating window w/ hotkey #550

@dsernst

Description

@dsernst

Feature description

It would be a bit smoother and easier if the main ChatGPT text input box was autofocused as soon as the window is opened with the hotkey.

Motivation

Smoother and easier way to invoke chatgpt, more like the default Cmd+Space Spotlight search on Mac.

Alternatives

Thinking this could be possible with some custom javascript to find the element and focus on it. Something like:

function focusOnInput () {
  // This currently works because there is only a single `<textarea>` element on the ChatGPT UI page.
  document.getElementsByTagName("textarea")[0].focus()
}
  1. And then calling this function when the Open Window hotkey is pressed.

  2. Or Perhaps another option would be to hook into document.addEventListener("visibilitychange", focusOnInput), if the Page Visibility API works for this sort of application. Unclear if this would work when bringing the window into focus, but if it does, it would work for opening the window with a mouse or using the Application Switcher too (Cmd + Tab).

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions