twenty icon indicating copy to clipboard operation
twenty copied to clipboard

Fix focus and escape in activity editor

Open lucasbordeau opened this issue 1 year ago • 5 comments

Scope & Context

In activity editor.

Current behavior

If we don't have the focus on a line in the activity editor, we have to hover precisely above the line we want to edit, and if it's a new one, over the last line.

This is not very user friendly.

Also we cannot escape focus or close the activity editor with shortcuts.

Expected behavior

We'd like to focus on the last empty line if we click anywhere below the last line, in the activity editor body :

Capture d’écran 2024-01-02 à 12 08 27

If there's no last empty line, create a new empty line in the last position

We also want to listen for keyboard events, and if the user types something, put the focus in the last empty line and write in what the user typed.

That way we can add new text easily.

We also want to use escape to :

  • Exit the focus on the activity editor body
  • Then close the right drawer if there's no focus on the activity editor body or on the fields in the header.

Technical input

  • Use our hooks : useListenClickOutside, useScopedHotkeys
  • Pay attention to how scoped hotkeys are used and respect the flow of setting the right hotkey scope (it should already be handled for those use cases)

lucasbordeau avatar Jan 02 '24 11:01 lucasbordeau

Hi @lucasbordeau can I work on this?

Muralidhar22 avatar Jan 02 '24 17:01 Muralidhar22

@Muralidhar22 Sure

lucasbordeau avatar Jan 08 '24 10:01 lucasbordeau

@Muralidhar22 any progress on this? Thanks a lot!

FelixMalfait avatar Jan 17 '24 11:01 FelixMalfait

Hi @FelixMalfait haven't started on this one, you can expect PR by this week, does that work?

Muralidhar22 avatar Jan 17 '24 13:01 Muralidhar22

Yes perfect thanks @Muralidhar22!

FelixMalfait avatar Jan 17 '24 16:01 FelixMalfait