Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pressing Enter in the Annotations column to navigate through a Decision Table creates unwanted rows #603

Open
azeghers opened this issue Oct 21, 2020 · 8 comments
Labels
backlog Queued in backlog bug Something isn't working ux

Comments

@azeghers
Copy link
Contributor

Describe the Bug

In the decision table, pressing enter focuses the row below the currently selected cell, and if it's the last row, creates a new one and focuses it.
But in the "Annotations" column, pressing enter from any selected row will just add a new one at the bottom and not change focus

decision_table

Steps to Reproduce

Steps to reproduce the behavior:

  1. Open a DMN Decision Table
  2. Click on any cell of the last column (Annotations) as if to input text
  3. Press enter

Expected Behavior

The cursor falls to the next cell below, and if there isn't one, a new row is added and focused.

Actual Behavior

The cursor stays in the selected cell and a new row is systematically appended at the end of the table.

Environment

  • Browser: Chrome 86.0.4240.75
  • OS: Ubuntu 20.04
  • Library version: v9.3.2
@azeghers azeghers added the bug Something isn't working label Oct 21, 2020
@azeghers
Copy link
Contributor Author

Blocks #602

@pinussilvestrus
Copy link
Contributor

Good finding, I was able to reproduce it on current master 👍

@pinussilvestrus pinussilvestrus added the ready Ready to be worked on label Oct 21, 2020
@pinussilvestrus pinussilvestrus added in progress Currently worked on and removed ready Ready to be worked on labels Oct 22, 2020 — with bpmn-io-tasks
@barmac
Copy link
Member

barmac commented Oct 26, 2020

Blocks #602

We discovered that #602 is not blocked entirely by this issue. We can tackle this separately.

@azeghers
Copy link
Contributor Author

This issue seems to stem from the fact that the annotations column and its cells aren't treated like the rest of the table cells.
For instance, its coordinates are stored as "2:annotation" instead of "2:4".
This results in helper functions returning NaN, or selecting the wrong cell because multiple cells share the same id.
My suggestions would be the following :
-Since the context menu needs to be reachable from any cell, give rows a rowId. It would make more sense than feeding it singular cell ids that are shared throughout the row.
-Treat the annotations column like the rest of the table, with a single, distinct id per cell and valid coordinates.
-The root objects shouldn't have collections of cells by type (input, output), but instead store whole rows and cols, and have a type attribute. This would make the visualization of the neighbor cells more intuitive.

@azeghers azeghers removed their assignment Oct 26, 2020
@azeghers azeghers added backlog Queued in backlog and removed in progress Currently worked on labels Oct 26, 2020 — with bpmn-io-tasks
@pinussilvestrus
Copy link
Contributor

Is this something that needs to be tackled earlier aka adding the "ready" label? @nikku

@nikku
Copy link
Member

nikku commented Oct 26, 2020

@azeghers mentions an important thing that we should talk about it in our weekly tomorrow.

The quirk is, that extensions can plug-in rows (and columns) and we need to find a way to handle that situation.

To evaluate the urgency on this bug, I'd look back and understand when it was introduced. Is it an old one or did we just recently break this behavior?

@barmac
Copy link
Member

barmac commented Oct 26, 2020

The bug was introduced via my context menu PR. Camunda Modeler 4.2 does not include it yet.

@nikku nikku added ready Ready to be worked on ux and removed backlog Queued in backlog labels Oct 26, 2020
@azeghers
Copy link
Contributor Author

This issue will sit in the backlog until the bug is reported by users.

Findings :

  • Because annotations are nothing more than a description of a rule in the business logic, its cells don't have a distinct id from the row. This causes the navigation logic to identify all cells that possess this row id, namely the index cell and the annotation cell. The queried cell is incidentally the former, the index cell.
  • This causes the navigation to try and select a cell that doesn't have coordinates, which isn't possible. A side effect of the impossibility to change focus is that a new rule is added in the process.
  • A very quick hack that was not accepted at this time would be to always select the latter of the 2 cells with the same id, since the only possible case for this situation to happen is selecting an annotation cell. This snippet would have been added to the Cell Selection utility file
export function getSelectableNodeById(elementId, container) {
  const cells = queryAll(`[data-element-id="${ cssEscape(elementId) }"]`, container);
  return cells[cells.length - 1];
}
  • The current implementation makes it difficult to solve this issue without refactoring a bigger chunk of its navigation system.
  • Possible alternatives :
    • Refactor the table logic to be completely separate from the DMN logic behind
    • Use dom manipulation instead of ids and coordinates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog bug Something isn't working ux
Projects
None yet
Development

No branches or pull requests

4 participants