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

Avoid trapping focus in Table #6803

Merged
merged 1 commit into from
May 31, 2024
Merged

Avoid trapping focus in Table #6803

merged 1 commit into from
May 31, 2024

Conversation

evansjohnson
Copy link
Contributor

Fixes #3834

Checklist

  • Includes tests
  • Update documentation
    • testable in existing table docs

Changes proposed in this pull request:

Immediately preventing default on tab key presses seems problematic since sometimes we return early and do nothing on the tab key press. This happens when the selection is already at the edge of the table and will not move further. This PR proposes that in these cases we should allow focus to freely leave the table.

I considered other solutions including:

  • Making this a new optional option.
    • In the next major version, this option could be defaulted to true, and possibly removed in the future if we see no valid cases where trapping focus is desired.
  • Introducing a new pattern to move focus into the table, such as Enter when the table is focused to switch to current behavior, and otherwise have the table be a single element in the tab order.
    • Esc would "exit" this interaction mode
    • Big downside of not being very discoverable
  • Are there other best practices for table interaction to consider?

Reviewers should focus on:

  • Is this the interaction pattern we want?
  • Should this be applied as a fix, or a new option?

Screenshot

n/a

@changelog-app
Copy link

changelog-app bot commented May 15, 2024

Generate changelog in packages/table/changelog/@unreleased

What do the change types mean?
  • feature: A new feature of the service.
  • improvement: An incremental improvement in the functionality or operation of the service.
  • fix: Remedies the incorrect behaviour of a component of the service in a backwards-compatible way.
  • break: Has the potential to break consumers of this service's API, inclusive of both Palantir services
    and external consumers of the service's API (e.g. customer-written software or integrations).
  • deprecation: Advertises the intention to remove service functionality without any change to the
    operation of the service itself.
  • manualTask: Requires the possibility of manual intervention (running a script, eyeballing configuration,
    performing database surgery, ...) at the time of upgrade for it to succeed.
  • migration: A fully automatic upgrade migration task with no engineer input required.

Note: only one type should be chosen.

How are new versions calculated?
  • ❗The break and manual task changelog types will result in a major release!
  • 🐛 The fix changelog type will result in a minor release in most cases, and a patch release version for patch branches. This behaviour is configurable in autorelease.
  • ✨ All others will result in a minor version release.

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

Avoid trapping focus in Table

Check the box to generate changelog(s)

  • Generate changelog entry

@svc-palantir-github
Copy link

Avoid trapping focus in Table

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@gluxon
Copy link
Contributor

gluxon commented May 30, 2024

Thanks for this fix!

I'm personally leaning towards not optionalizing this and treating it as a fix. I can't imagine any users that would want the Blueprint table to trap focus within it. 🤔

Copy link
Contributor

@gluxon gluxon left a comment

Choose a reason for hiding this comment

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

Approving based on my thoughts above. I think this is the right fix. Let me gut check this with another person to make sure this sounds reasonable.

@gluxon gluxon requested review from ericjeney, styu, pgoldberg and invliD May 30, 2024 18:55
Copy link
Contributor

@pgoldberg pgoldberg left a comment

Choose a reason for hiding this comment

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

I agree that this should just be treated as a fix – I imagine no one wants the behavior of tables trapping focus

@gluxon gluxon merged commit 7b73100 into develop May 31, 2024
12 of 14 checks passed
@gluxon gluxon deleted the evanj/table-focus-trap-fix branch May 31, 2024 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blueprint table is a keyboard trap
5 participants