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

fix: pressing arrow left next to = adds ref for left cell #1790

Merged
merged 2 commits into from
Sep 4, 2024
Merged

Conversation

AyushAgrawal-A2
Copy link
Collaborator

closes #1758

Copy link

qa-wolf bot commented Aug 24, 2024

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@cla-bot cla-bot bot added the cla-signed label Aug 24, 2024
Copy link

vercel bot commented Aug 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quadratic ✅ Ready (Inspect) Visit Preview Aug 27, 2024 6:05am

Copy link

codecov bot commented Aug 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.91%. Comparing base (178cfc0) to head (dcf5c10).
Report is 146 commits behind head on qa.

Additional details and impacted files
@@           Coverage Diff           @@
##               qa    #1790   +/-   ##
=======================================
  Coverage   90.91%   90.91%           
=======================================
  Files         206      206           
  Lines       41911    41911           
=======================================
  Hits        38104    38104           
  Misses       3807     3807           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@davidkircos
Copy link
Collaborator

davidkircos commented Aug 24, 2024

Nice! This solves the issue in the attached PR.

If it's simple we should also make left arrow work for any positon where you can reference a cell. For example if you do

=[Left arrorw] + [Left arrow]
the second left arrow should also reference the cell to the left, not move the cursor within the formula
https://github.com/user-attachments/assets/e9fb287f-0ef7-423b-9e47-8f117515c398

@AyushAgrawal-A2
Copy link
Collaborator Author

If it's simple we should also make left arrow work for any positon where you can reference a cell. For example if you do

=[Left arrorw] + [Left arrow]
the second left arrow should also reference the cell to the left, not move the cursor within the formula

@davidkircos
this is currently disable for both left and right arrow, current code restricts the behaviour to

  • Left arrow adds cell reference if pressed when cursor is next to = (added in this PR)
  • Right arrow adds cell reference if pressed when cursor is at last position

we should enable both or none for inserting cell references when cursor in middle of text. there is existing logic to decide whether a cursor position wants a cell ref or not. should be easy to just enable it, but there must be a reason why this was disabled in the first place.

@davidkircos
Copy link
Collaborator

davidkircos commented Aug 25, 2024

If it's simple we should also make left arrow work for any positon where you can reference a cell. For example if you do
=[Left arrorw] + [Left arrow]
the second left arrow should also reference the cell to the left, not move the cursor within the formula

@davidkircos this is currently disable for both left and right arrow, current code restricts the behaviour to

  • Left arrow adds cell reference if pressed when cursor is next to = (added in this PR)
  • Right arrow adds cell reference if pressed when cursor is at last position

we should enable both or none for inserting cell references when cursor in middle of text. there is existing logic to decide whether a cursor position wants a cell ref or not. should be easy to just enable it, but there must be a reason why this was disabled in the first place.

We want to match the behavior of other spreadsheets. Other sheets allow any arrow keys to select cells at any valid position for a cell reference in the Formula.

@HactarCE
Copy link
Collaborator

We want to match the behavior of other spreadsheets. Other sheets allow any arrow keys to select cells at any valid position for a cell reference in the Formula.

Other spreadsheets also disable arrow key cell selection after clicking in the inline editor. Personally I find this hidden state very confusing (and inconvenient, since I like navigating text using keyboard) but we'll need to track it if we want consistency.

Copy link
Collaborator

@davidkircos davidkircos left a comment

Choose a reason for hiding this comment

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

Implementing more of the Excel behavior makes sense in this PR. This behavior is really important for users with Formulas.
specifically:

  • All arrow keys can be used to select cells in any valid cell reference position in a formula.

@AyushAgrawal-A2
Copy link
Collaborator Author

If it's simple we should also make left arrow work for any positon where you can reference a cell. For example if you do

=[Left arrorw] + [Left arrow]
the second left arrow should also reference the cell to the left, not move the cursor within the formula

@davidkircos
done

Copy link
Collaborator

@davidkircos davidkircos left a comment

Choose a reason for hiding this comment

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

This seems to work great! Big improvement!

Copy link
Collaborator

@HactarCE HactarCE left a comment

Choose a reason for hiding this comment

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

It is now effectively impossible to edit a formula using only the keyboard without retyping the whole thing. I find this inconvenient personally, but I think it's also an accessibility issue.

Left arrow next to the initial = is ok because there's no reason to have your cursor to the left of =, but now it's basically impossible to move the cursor within the inline formula editor.

Anecdotally, it feels very inconsistent: occasionally left arrow moves within the formula, other times it inserts a cell reference, and usually it just closes the formula editor entirely. I prefer requiring up/down arrows to insert cell references, because those are not used for single-line text navigation anyway so there's no conflict.

@davidkircos
Copy link
Collaborator

davidkircos commented Aug 28, 2024

It is now effectively impossible to edit a formula using only the keyboard without retyping the whole thing. I find this inconvenient personally, but I think it's also an accessibility issue.

Left arrow next to the initial = is ok because there's no reason to have your cursor to the left of =, but now it's basically impossible to move the cursor within the inline formula editor.

Anecdotally, it feels very inconsistent: occasionally left arrow moves within the formula, other times it inserts a cell reference, and usually it just closes the formula editor entirely. I prefer requiring up/down arrows to insert cell references, because those are not used for single-line text navigation anyway so there's no conflict.
@HactarCE
How does our behavior differ from other spreadsheets? I didn't have any issues editing formulas with just the keyboard.

@HactarCE
Copy link
Collaborator

HactarCE commented Aug 29, 2024

Excel has the behavior of this PR (or close to it) when initially creating a formula (by double-clicking a blank or non-formula cell and typing =, or by selecting any cell and pressing =). There are three actions that break out of this mode:

  • Clicking once in the inline editor while it is already open
  • Double-clicking on an existing formula cell to edit it
  • Pressing F2 to edit a cell (whether it is blank or contains a formula)

After any of those three actions, arrow keys navigate within the inline editor and it becomes impossible to use the arrow keys to insert a cell reference.


Google Sheets is even more confusing; it is similar to Excel, but it's sometimes possible to re-enter the "arrow keys to insert cell references" state. If I type =B1+C1 into a cell, then close and reopen the formula editor and press backspace twice to delete C1, then whether I can use arrow keys to insert a cell reference depends on the timing between my two backspace keypresses.

Screen.Recording.2024-08-28.at.9.19.04.PM.mov

IMO both of these behaviors are surprising (hidden state! and why is F2 different from double-clicking?) and inconvenient (I can't insert cell references when editing an existing formula?) Personally, I like Quadratic's current behavior because it has no hidden state and is always possible to navigate within the inline editor (using left/right) and insert cells (using up/down), although inserting a reference to a left/right cell requires the counterintuitive key sequence . I think replicating Excel's behavior (or any hybrid between what Excel does and what we currently do) would also be acceptable.

@AyushAgrawal-A2 AyushAgrawal-A2 added the status: open question Unclear - needs better defined before becoming a high prio issue label Aug 30, 2024
@davidkircos davidkircos merged commit f509fbb into qa Sep 4, 2024
14 checks passed
@davidkircos davidkircos deleted the ayush/1758 branch September 4, 2024 01:20
Copy link

qa-wolf bot commented Sep 4, 2024

E2E tests

QA 5 blocking bugs

Ran Status Preview Started Run time Est. dev time saved
71 workflows Done (Details) Sep 4, 2024 at 1:51 AM (UTC) 16 minutes ~40.33 hrs
✅ 45 passed

Preexisting bugs

5 Blocking bugs
If you are aware of any of these bugs, you can set their priority to low and prevent them from causing a run failure.
View all blocking bugs

1 Non-blocking bug

. . . . . . . .

Re-run your E2E tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed status: open question Unclear - needs better defined before becoming a high prio issue status: ready for user test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nit: typing = then pressing left arrow should select cell to the left not move cursor over
4 participants