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

Improve cell focus behavior #2989

Merged
merged 5 commits into from
Jul 21, 2023
Merged

Conversation

seancolsen
Copy link
Contributor

Fixes #1892
Fixes #2380

Notes

  • I started working on Re-focus table cell after opening record selector on that cell #1892 first but ended up chasing down Synchronize cell "active" and "focused" states #2380 in the process. That's why this PR addresses them both.
  • Re-focus table cell after opening record selector on that cell #1892 is pretty straightforward, and I think it should be easy to see that this PR addresses it. Launch the record selector from an FK cell. Close the selector either by submitting a value or by closing the model. Before this PR, the FK cell would no longer be focused (although it was hard to tell). After this PR, the cell regains focus, allowing you to use the keyboard to continue navigating from cell to cell.
  • Synchronize cell "active" and "focused" states #2380 is the more nebulous issue, where we had some discussion in the ticket about various implementation approaches and only seemed to reach a clear agreement on the main objective. So this PR is a rough stab at addressing that main objective. Basically: the cell still has an 'active' state, kept separate from its focused state; but now the cell is styled differently depending on whether it is focused. We had previously styled the cell outline gray for disabled cells. I repurposed that gray styling to indicate the state when the cell is active but no focused.
  • I agree with @pavish that we need to retain state to track when a cell is active but not focused. And I think we're both in agreement that we should try to prevent the user from inadvertently causing the cell to enter this state. For example, after the record selector closes, we should re-focus the cell to avoid the "active but not focused" state.
  • What's nice about these changes is it makes it easier for us devs to spot that pesky "active but not focused" state. In playing with the app after these changes, I noticed and reported two new bugs: Cell loses focus when clicking on its outline #2987 URL cell loses focus when clicking on its contained hyperlink #2988

Before

  • Cell outline was blue when cell was active and not disabled.
  • Cell outline was gray when cell was active and disabled.
  • The focus state did not affect the cell outline.
  • Opening and closing the record selector caused the cell to lose focus

After

  • Cell outline is blue when the cell is active and focused.
  • Cell outline is gray when the cell is active and not focused.
  • Cell has no outline otherwise
  • The cell is re-focused after the record selector closes

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.

CellWrapper has no way of dispatching an 'activate' event, so there's
no need to forward it.
## Before

- Cell outline was blue when cell was active and not disabled.
- Cell outline was gray when cell was active and disabled.
- The focus state did not affect the cell outline.

## After

- Cell outline is blue when the cell is active and focused.
- Cell outline is gray when the cell is active and not focused.
- Cell has no outline otherwise
- Code readability is improved somewhat.
@seancolsen seancolsen added this to the Next release milestone Jul 3, 2023
@seancolsen seancolsen added the pr-status: review A PR awaiting review label Jul 3, 2023
Copy link
Member

@pavish pavish left a comment

Choose a reason for hiding this comment

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

Looks great! Nice work!

@pavish pavish added this pull request to the merge queue Jul 21, 2023
Merged via the queue into develop with commit bf11d5c Jul 21, 2023
@pavish pavish deleted the 1892_focus_cell_after_record_selector branch July 21, 2023 00:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr-status: review A PR awaiting review
Projects
No open projects
2 participants