Improving inputs in NotificationRequests

Part of my extension’s functionality is for the user to run a command (either via a menu option or the Command Pallet) and then provide a brief piece of input to act as a parameter for the command.

NotificationRequest allows for the displaying of such an input (and is the only way of gathering a user’s input at the point of request, as far as I can tell). By default the notification appears at the top-right of Nova; however the user experience is currently a little awkward for a couple of reasons:

  • Notifications frequently blend in with the editor colour scheme, so it’s not always obvious that one has appeared, creating user confusion as the command appears to have not worked.
  • The input within the notification is not focused by default, so the user has to manually click on and focus the input before they can start typing.

While I’m aware that forcibly moving the user’s keyboard focus to elsewhere is potentially not amazing for accessibility reasons, it feels like having the option to do so for notifications containing inputs would be more beneficial than not. It’s something I think should be possible!

1 Like

As an alternative, if you are just looking for a way to ask for user input immediately when they invoke the command, you might consider the workspace.showInputPalette() or workspace.showInputPanel() APIs. These display a direct prompt to the user that takes keyboard focus.

1 Like

Huh, thanks! Have changed my extension to use showInputPanel() instead. That’s what I get for skimming the docs and going for the first thing I saw about obtaining user input. :stuck_out_tongue: