fix: cursor jumps when editing definition properties#953
fix: cursor jumps when editing definition properties#953L2jLiga wants to merge 1 commit intobpmn-io:developfrom
Conversation
When definition properties are edited it fires `Modeling#updateProperties`. This method fires command `element.updateProperties` via commandStack to update element, same time `DrdUpdater` is subscribed to this command and do `DefinitionPropertiesView#update` when it executed. When `DefinitionPropertiesView#update` is called it updates textContent of corresponding elements unconditionally which leads to cursor jump. In order to workaround issue with jumping cursor I've added condition that checks if element currently in focus and if so it prevent update of element content Fixes bpmn-io#951 Fixes bpmn-io#274
As you mention, this is a workaround. Alternatives could be:
Consider the discussion on #951. We want to first understand what we build, and two options are at play. |
Sure, when I started working on this issue there weren't any discussion atm, now I see you've discussed, let me add my few thoughts :)
This two are actually not an option due to trimming value. It will lead to cursor jumps in case when user enter space character at begining or at the end of line
I think this is best option, it will work similar to proposed changes |
|
@L2jLiga will you continue working on this? |
|
Hi @jarekdanielak, I could but currently expectations are not clear for me. Proposed changes already fixes both issues by disabling field value update while it's in focus. From #951 I see two another solutions proposed - completely disable intermediate value emission or start using
So atm I'm just waiting for any further disscussions to understand which solution I have to implement, sorry if I understand this wrong :) |
|
@jarekdanielak please follow up. @L2jLiga, sorry for the long wait time. |
|
From the proposed solutions, only updating the value on blur seems the most straight-forward and follows our practice, e.g. updating values in the properties panel. @L2jLiga I haven't digged into the |
When definition properties are edited it fires
Modeling#updateProperties. This method fires commandelement.updatePropertiesvia commandStack to update element, same timeDrdUpdateris subscribed to this command and doDefinitionPropertiesView#updatewhen it executed.When
DefinitionPropertiesView#updateis called it updates textContent of corresponding elements unconditionally which leads to cursor jump. In order to workaround issue with jumping cursor I've added condition that checks if element currently in focus and if so it prevent update of element contentFixes #951
Fixes #274
Proposed Changes
Checklist
To ensure you provided everything we need to look at your PR:
@bpmn-io/srtoolCloses {LINK_TO_ISSUE}orRelated to {LINK_TO_ISSUE}