You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ShortcutRegistration allows to reset the focus to force a ValueChangeEvent on the server so that the ShortcutListener can work with the current value.
However, if the focused field has autoselect set to true, the resetFocus selects all text. In my case a shortcut opens a dialog with predefined texts that should be inserted at the current cursor position. This is not possible at the moment.
Expected behavior
The selection should not be changed, it should only force a value change event.
Minimal reproducible example
Add a TextField to a webpage
Register a Shortcut with resetFocusOnActiveElement
Select part of the text and then execute the shortcut
Versions
Flow: 24.6.2
Vaadin: 24.6.2
Copilot: 24.6.2
Frontend Hotswap: Enabled, using Vite
OS: amd64 Windows 11 10.0
Java: Eclipse Adoptium 21.0.3
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Java Hotswap: Hotswap is not enabled
IDE Plugin: Not installed
The text was updated successfully, but these errors were encountered:
@mshabarov the problem affects all inputs and textareas and the related method resetFocus is a global method under window.Vaadin.Flow, so I don't think it can be solved in the components.
@yuriy-fix Originally the resetFocusmethod was introduced to solve this issue, so it basically only exists to force a value change event so that the server knows the current value when executing the shortcut.
If there was another method to force a value change, this method would never have been introduced. So losing the selection is, in my opinion, a negative side effect of the used solution and not the desired / expected behavior.
Description of the bug
The
ShortcutRegistration
allows to reset the focus to force aValueChangeEvent
on the server so that theShortcutListener
can work with the current value.However, if the focused field has autoselect set to true, the
resetFocus
selects all text. In my case a shortcut opens a dialog with predefined texts that should be inserted at the current cursor position. This is not possible at the moment.Expected behavior
The selection should not be changed, it should only force a value change event.
Minimal reproducible example
Versions
Flow: 24.6.2
Vaadin: 24.6.2
Copilot: 24.6.2
Frontend Hotswap: Enabled, using Vite
OS: amd64 Windows 11 10.0
Java: Eclipse Adoptium 21.0.3
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Java Hotswap: Hotswap is not enabled
IDE Plugin: Not installed
The text was updated successfully, but these errors were encountered: