text icon indicating copy to clipboard operation
text copied to clipboard

Always focus href entry after using mod-k keyboard shortcut

Open max-nextcloud opened this issue 4 months ago • 1 comments

Describe the bug The behavior of mod-k is still inconsistent. In particular it will not focus the link entry if the href already was falsy - for example right after the start. (Follow up for #7599 )

To Reproduce Steps to reproduce the behavior:

  1. Open a new text document.
  2. Enter some word.
  3. Select the word (mod-a) and turn it into a link (mod-k)
  4. See that the link entry does not receive focus.

It works after showing the link bubble for a link with an actual href. It does not work directly after showing the link bubble for a link with an empty href.

Expected behavior Whenever the shortcut is used link bubble should open with the link text entry focussed.

Server details:

  • Nextcloud version: 31, 32

Client details:

  • Browser: tested with Electron and FF
  • Device: Desktop

There are no errors in the relevant logs. It's just that key inside the LinkBubbleView stays the same so the watcher does not trigger.

max-nextcloud avatar Sep 01 '25 19:09 max-nextcloud

I tried to watch href instead and distinguish null from an empty string. Made sure href was null when no link was selected and an empty string when a new link as selected. However this also led to the link entry getting focussed when navigating into an empty link for example by using the cursor keys.

Instead I think we want to introduce a new editor command to focus the link entry and use that:

  1. Call command from the keyboard shortcut.
  2. command triggers a transaction with a specific meta key.
  3. transaction updates some value in the state of LinkBubblePluginView.
  4. That state is handed to the component and watched.

max-nextcloud avatar Sep 01 '25 19:09 max-nextcloud