soccerloway / quill-better-table

Module for better table in Quill, more useful features are supported.
MIT License
313 stars 120 forks source link

ArrowDown skips to last row in FireFox #32

Closed UnivocalHoneyBadger closed 4 years ago

UnivocalHoneyBadger commented 4 years ago

When your selection is on a line above a table and press ArrowDown, the selection will jump to the last row instead of the first, skipping the other rows.

ArrowUp does work though.

This behaviour is vastly different than in Chrome.

In Chrome the selection will go to the first cell in the first row, then second cell, etc. When it reaches the last cell in a row it will go on to the next row and first cell.

Simply put: In Chrome ArrowDown/Up will navigate through the table horizontally. In FireFox ArrowDown/Up will navigate through the table vertically, but, skips to the last row when using ArrowDown.

soccerloway commented 4 years ago

Thanks for your report~ I really neglected this problem. I have already added handlers for ArrowDown/ArrowUp in 1.2.7. It should have the same behavior now.

soccerloway commented 4 years ago

Behavior now:

  1. ArrowDown to table, the cursor will jump to the first cell in first row.
  2. ArrowDown/ArrowUp handles movement of cursor between table rows.
UnivocalHoneyBadger commented 4 years ago

Thanks for the good work, however, the behaviour is not quite proper yet. While the selection does not skip to last row anymore. It works in FireFox, but it does behave weirdly in Chrome.

In Chrome it tries to stick to it's default behaviour, when you're on a line below the table and press ArrowUp it will go to the last cell in the table.

Below is a gif of what's happening: UnQTmv3hcp

soccerloway commented 4 years ago

Actually, I made the behavior :) I think it's good to uniform its behavior no matter in ff or chrome.

Behavior now: ArrowDown from above to table, the cursor will jump to the first cell in first row. ArrowDown/ArrowUp handles movement of cursor between table rows. ArrowUp from below to table, the cursor will jump to the last cell in last row.

I will compare with some other rich-text editors, hope that find a comfortable way.

UnivocalHoneyBadger commented 4 years ago

I think the best behaviour would be: ArrowDown from above the table: cursor goes to first row ArrowDown/ArrowUp in the table: cursor moves vertically ArrowUp from below the table: goes to first cell on last row

This is also the behaviour for tables in LibreOffice and Google documents. I think it's weird for the navigation to change depending on whether you start below or above a table. It's very counter-intuitive.

Regardless of how the behaviour is, I do think it's important the same behaviour is applied to all browsers.

soccerloway commented 4 years ago

You are right I think, I will change the behaviour:

ArrowUp from below the table: goes to first cell on last row