Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

141 move in cell#172

Merged
valentijnnieman merged 13 commits intomasterfrom
141-move-in-cell
Oct 30, 2018
Merged

141 move in cell#172
valentijnnieman merged 13 commits intomasterfrom
141-move-in-cell

Conversation

@valentijnnieman
Copy link
Copy Markdown
Contributor

Closes #141, this allows users to use keyboard navigation (arrow keys) when editing a cell, i.e. when a cell's input is focused.

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 24, 2018 20:15 Inactive
expect($container.first()[0].innerText).to.equal(`[249][0] = ${initialValue} -> abc`);
});
});
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to see a test on edit first + arrowup


handleKeyDown = (e: KeyboardEvent) => {
if (e.keyCode !== KEY_CODES.ENTER && e.keyCode !== KEY_CODES.TAB) {
if (!isNavKey(e.keyCode)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong. Prior to this change, once you started modifying the content of the cell, the up/down arrow would send you to the beginning/end of the cell content. The left/right arrow in this mode would move you one character over to the left/right. Now, when editing up/down will leave & save (which is the desired behavior), but it's now impossible to navigate the content with left/right.

I think the change should only apply to up/down and leave left/right as is (user can still navigate to beginning/end of content by typing cmd/ctrl + left/right)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In all cases there is a potential usability issue here: either the user cannot navigate the cell content or they get a different behavior on up/down vs. left/right.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair point. I'm checking out Google spreadsheets and I'm noticing that if you click on the cell, you can edit it, and the arrow keys navigate the table. If you double click, you can edit the cell, and the arrow keys will move inside the input. You can edit the content and navigate, or if you really want to do specific edits you double click. Is that something we should do here as well? Was that the idea all along?

I am not, to be honest, super up to date with web usability/accessibility these days, but I could see that this might be an issue, since we're overriding the default <input> behaviour here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cldougl Would you take a look at this as well?

@Marc-Andre-Rivet
Copy link
Copy Markdown
Contributor

Marc-Andre-Rivet commented Oct 24, 2018

Pulling @chriddyp as reviewer since he opened the issue.

Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • left/right arrow change in behavior affects usability negatively in my opinion / I think this should be reverted
  • want to make sure we engage in a usability discussion about the whole change

@chriddyp
Copy link
Copy Markdown
Member

chriddyp commented Oct 24, 2018

In all cases there is a potential usability issue here: either the user cannot navigate the cell content or they get a different behavior on up/down vs. left/right.

Yeah, this is subtle. I recommend looking at the behaviour of excel (if you have it), google spreadsheet, or the spreadsheet component we use in chart studio: https://plot.ly/create

In spreadsheets, there are two modes for cell editing. I've marked which cases work on master with an ✅ and which ones don't with an ✖️

focussed mode

  1. ✅ a cell is in focussed when you click on it (once) or when you navigate to it with the keyboard
  2. ✅ arrowing (in any direction) or tabbing in focussed mode changes the cells, keeps it in focussed mode
  3. ✅ typing in focussed mode overrides the cell's contents with what you have typed
  4. ✖️ enter moves the cell down (Excel) or into edit mode (Google Docs)
    • we do this the google docs way rather than the excel way. we should do it the excel way if possible. i'm not concerned about this for launch.
  5. ✅ pasting a string will replace the cells contents with that string
  6. ✅ pasting a group of cells will paste the contents across those cells
  7. visually, edit is distinct from focussed mode by:
    a. ✅ not having a cursor
    b. ✖️ not having any highlighted text
    - 🌈 seeing the highlighted text when in focussed mode does not look right and it makes it harder to distinguish between the two modes. this would be a 'nice to have' for launch.
  8. ✖️ typing text keeps the cell in focussed mode: after typing, arrowing moves the cell, it does not move the cursor
  9. delete deletes the cell
  10. escape reverts the edit back to what the cell's contents originally were

edit mode

  1. ✖️ a cell is in edit mode when you double-click
    • slow double click works, but not the typical fast double-click
  2. ✅ a cursor for editing the contents of the text appears
  3. in google docs, you can also get in edit mode by pressing enter while in focussed mode
  4. ✖️ In excel, F2 also gets you into edit mode
    • i'm not concerned about this for launch
  5. ✅ arrowing left-right in edit mode changes the cursor by single character.
  6. ✅ arrowing up-down in edit mode moves the cursor to the front or the back of the cells contents
  7. enter moves the focus down one cell into focussed mode
  8. tab moves the focus to the right one cell into focussed mode
  9. ✖️ pasting a string will paste the contents in the cursor location
    • i'm not concerned about this for launch
  10. ✖️ pasting a series of cells isn't allowed in excel. in google docs it will paste it as a multi-line string.
    • we actually do neither of these - we have the same behaviour as focussed: it pastes into several cells. That's OK for now, since the way we distinguish between these two states isn't super tight or visually apparent. In the future, it'd be nice to tighten this up.
  11. visually, edit is distinct from focussed mode by:
    a. ✅ having a cursor
    b. ✅ allowing text to highlight
  12. delete deletes the letter
  13. escape reverts the cell back to what the cell's contents originally were and transitions the cell into focussed mode
    So, we're very close to having the exact excel-like behavior in master. The main thing that I'm concerned about for launch is Item 8 under focussed. The other ✖️ 's we should get to, but we can do it after launch.

I hope that clears things up. This stuff is really tricky, I have to manually go through the motions every time 🙈

@valentijnnieman
Copy link
Copy Markdown
Contributor Author

valentijnnieman commented Oct 24, 2018

@chriddyp Ah, so that sounds kind of what I'm describing in the comment above (#172 (comment)), yes? That makes sense to me. Thanks for the detailed list, really very interesting to think about these issues in depth and how users interact with this stuff!

@chriddyp
Copy link
Copy Markdown
Member

Also note that there is a 3rd mode which I'll call "multi-select":
image

in "multi-select", there is the concept for an individual active cell which you can activate with tab:
tab-multi-cell

multi-select

  • ✅ shift-arrow-keys brings you into multi-select
  • ✅ shift-click brings you into multi-select
  • delete clears the contents of each cell
  • ✅ tabbing around cells moves the "active" cell around
  • arrow transitions the cell into focussed, and moves the active cell down
    • ✅ note that the active cell may not necessarily be the first cell, as the user may have tabbed around in multi-select mode first
  • ✅ the active cell acts like a focussed cell w.r.t typing and entering
  • ✅ deleting will always delete the contents, even if the active cell has moved around

it's good just to be aware of this behavior as it also affects all of these navigation keys

@chriddyp
Copy link
Copy Markdown
Member

i'll make new issues for the rest of the unsupported items and move them into the priority #2 column.

@chriddyp
Copy link
Copy Markdown
Member

issue for the remaining items: #174

@Marc-Andre-Rivet
Copy link
Copy Markdown
Contributor

@valentijnnieman Updated issue with additional tests in #141 (comment)

As is the PR breaks

edit mode

5. ✅ arrowing left-right in edit mode changes the cursor by single character.
6. ✅ arrowing up-down in edit mode moves the cursor to the front or the back of the cells 

@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 29, 2018 17:56 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 29, 2018 19:04 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 29, 2018 20:34 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 29, 2018 20:41 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 29, 2018 20:54 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 30, 2018 14:34 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 30, 2018 15:26 Inactive
@chriddyp chriddyp temporarily deployed to dash-table-review-pr-172 October 30, 2018 15:27 Inactive
Copy link
Copy Markdown
Member

@chriddyp chriddyp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯 💯 💯 the interactions are working very well now! Looks like you knocked off a few other items as well, like the differentiated styles between the focussed and active state.

💃 from me for the UI side of things

it('on cell modification', () => {
DashTable.getCell(0, 0).click();
DOM.focused.type(`10${Key.Enter}`);
DashTable.getCell(1, 1).click();
Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet Oct 30, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since navigation_test 'does focus on next cell input on text + "enter"' passes, this should work without the click. Test is moot right now :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐮 Test is moo!

Copy link
Copy Markdown
Contributor

@Marc-Andre-Rivet Marc-Andre-Rivet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm :)

@valentijnnieman valentijnnieman merged commit 5be420b into master Oct 30, 2018
@valentijnnieman valentijnnieman deleted the 141-move-in-cell branch October 30, 2018 18:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants