Skip to content

Conversation

@L2jLiga
Copy link

@L2jLiga L2jLiga commented Jul 10, 2025

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 #951
Fixes #274

Proposed Changes

Checklist

To ensure you provided everything we need to look at your PR:

  • Brief textual description of the changes present
  • Visual demo attached
  • Steps to try out present, i.e. using the @bpmn-io/sr tool
  • Related issue linked via Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}

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
@nikku
Copy link
Member

nikku commented Jul 14, 2025

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

As you mention, this is a workaround. Alternatives could be:

  • Prevent saving of the intermediate update
  • Ensure we properly update/preserve the cursor, if the element is present (ref)
  • Only forcefully update if textContent !== newTextContent

Consider the discussion on #951. We want to first understand what we build, and two options are at play.

@L2jLiga
Copy link
Author

L2jLiga commented Jul 14, 2025

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 :)

  • Ensure we properly update/preserve the cursor, if the element is present (ref)
  • Only forcefully update if textContent !== newTextContent

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

  • Prevent saving of the intermediate update

I think this is best option, it will work similar to proposed changes

@barmac barmac requested review from a team, Buckwich, abdul99ahad, jarekdanielak and philippfromme and removed request for a team, abdul99ahad and philippfromme July 29, 2025 12:45
@jarekdanielak
Copy link
Contributor

@L2jLiga will you continue working on this?

@jarekdanielak jarekdanielak marked this pull request as draft August 29, 2025 08:59
@L2jLiga
Copy link
Author

L2jLiga commented Aug 31, 2025

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 selection-update to fix input behavior. As @nikku said

Consider the discussion on #951. We want to first understand what we build, and two options are at play.

So atm I'm just waiting for any further disscussions to understand which solution I have to implement, sorry if I understand this wrong :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Input Jumps to start for DMN name and id DRD: Cursor skips to beginning of definitions name on SPACE

3 participants