Skip to content

Conversation

@Hardyx07
Copy link

@Hardyx07 Hardyx07 commented Nov 7, 2025

Fixes #4906

This PR adds the ability to expand or shrink your cell selection using Shift + Arrow keys in the sheet UI, as requested in #4906.

  • Current behavior: Arrow keys move the active cell, but do not expand selection.
  • New behavior: Holding Shift and pressing an Arrow key now expands (or contracts) the selection in the direction of the pressed key, starting from the active cell. This matches the Google Sheets selection workflow and greatly improves spreadsheet usability.

Technical details

  • Updated cell selection logic to track selection origin and expand/collapse selection as Shift+Arrow keys are pressed.
  • No breaking changes. Code follows established project style.
  • Only relevant frontend files are changed. No unrelated code modifications.

Testing instructions

  • Open any sheet
  • Select any cell
  • Hold Shift and press Arrow keys (up, down, left, right)
  • Watch the selection expand or contract in the correct direction

Checklist

  • My pull request has a descriptive title (not a vague title like Update index.md).
  • My pull request targets the develop branch of the repository
  • My commit messages follow best practices.
  • My code follows the established code style of the repository.
  • I added tests for the changes I made (if applicable).
  • I added or updated documentation (if applicable).
  • I tried running the project locally and verified that there are no
    visible errors.

Developer Certificate of Origin

Developer Certificate of Origin
Developer Certificate of Origin
Version 1.1

Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
1 Letterman Drive
Suite D4700
San Francisco, CA, 94129

Everyone is permitted to copy and distribute verbatim copies of this
license document, but changing it is not allowed.


Developer's Certificate of Origin 1.1

By making a contribution to this project, I certify that:

(a) The contribution was created in whole or in part by me and I
    have the right to submit it under the open source license
    indicated in the file; or

(b) The contribution is based upon previous work that, to the best
    of my knowledge, is covered under an appropriate open source
    license and I have the right under that license to submit that
    work with modifications, whether created in whole or in part
    by me, under the same open source license (unless I am
    permitted to submit under a different license), as indicated
    in the file; or

(c) The contribution was provided directly to me by some other
    person who certified (a), (b) or (c) and I have not modified
    it.

(d) I understand and agree that this project and the contribution
    are public and that a record of the contribution (including all
    personal information I submit with it, including my sign-off) is
    maintained indefinitely and may be redistributed consistent with
    this project or the open source license(s) involved.

@Anish9901
Copy link
Member

Hey @Hardyx07, can you please update the PR description?

@Anish9901 Anish9901 requested a review from seancolsen November 10, 2025 13:05
@Anish9901 Anish9901 added the pr-status: review A PR awaiting review label Nov 10, 2025
@Hardyx07
Copy link
Author

Hey @Hardyx07, can you please update the PR description?

Hi @Anish9901 , I’ve updated the PR description with more details as requested. Please let me know if anything else is needed!

Copy link
Contributor

@seancolsen seancolsen left a comment

Choose a reason for hiding this comment

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

There seem to be many inconsistencies between the behavior of Google Sheets and the behavior of this PR.

For example say you have this selection

Shift+Down works. Okay.

But the following keyboard shortcuts do not work the same way that Google Sheets works:

  • Shift+Up
  • Shift+Right
  • Shift+Left

As I play with different shapes of selections it's very easy to find lots of different inconsistencies. I won't spend time trying to list them all out. This needs a lot more QA.

Also, looking at the code. Wow, that's much more code than I would expect this implementation to be. I've not spent time reading through it at all (because clearly some logic needs to be fixed first). But so many levels deep of if/else statements is a major code smell here. It's hard to read code like that and reason about it. My hunch is that you need to rethink the approach.

@seancolsen seancolsen assigned Hardyx07 and unassigned seancolsen Nov 17, 2025
@seancolsen seancolsen added pr-status: revision A PR awaiting follow-up work from its author after review and removed pr-status: review A PR awaiting review labels Nov 17, 2025
@Hardyx07
Copy link
Author

@seancolsen Got it. I’ll rethink the approach and clean up the architecture.

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

Labels

pr-status: revision A PR awaiting follow-up work from its author after review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Shift+Arrow to select cell range

3 participants