[local-explorer-ui] Fix data studio cell keydown swallowing browser shortcuts#14531
Open
matingathani wants to merge 6 commits into
Open
[local-explorer-ui] Fix data studio cell keydown swallowing browser shortcuts#14531matingathani wants to merge 6 commits into
matingathani wants to merge 6 commits into
Conversation
…used table cells The data studio table's onKeyDown handler called e.preventDefault() unconditionally after its key-matching chain, so any key it didn't recognize (e.g. Cmd+<number> tab-switch shortcuts) still got blocked while a cell was focused but not being edited. Only preventDefault for keys the grid actually handles. Fixes cloudflare#14524
🦋 Changeset detectedLatest commit: 411d6c2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@cloudflare/autoconfig
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Extract onKeyDown's key-handling logic into an exported, dependency-injected handleStudioTableKeyDown so it can be unit tested without rendering the component (this package has no React render-test infra). Covers: unhandled keys pass through (the cloudflare#14524 regression), recognized navigation keys still preventDefault, edit-mode short-circuit, and the customKeyDownHandler (copy/paste) interaction.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #14524
In the data studio table for D1 databases / Durable Objects, clicking a table cell (read-only, not editing) and then pressing a browser shortcut like
Cmd+1did nothing — the keydown was swallowed instead of reaching the browser.StudioTable'sonKeyDownhandler (packages/local-explorer-ui/src/components/studio/Table/index.tsx) callede.preventDefault()unconditionally after itsif/else-ifchain of recognized navigation keys (arrows, Tab, Enter). Any other key — including allCmd/Ctrl+<key>browser shortcuts — fell through to that samepreventDefault()since there was noelsebranch and no check one.metaKey/e.ctrlKey.Fix: added an
else { return; }before thepreventDefault(), so it only fires for the keys the grid itself handles. Everything else now passes through untouched.Also extracted the key-handling logic into an exported
handleStudioTableKeyDownfunction (dependency-injected, no closures) so it's unit-testable without rendering the component — this package has no React render-test infra (no testing-library/jsdom), so this keeps the new test a plain Vitest unit test consistent with the rest of the package's tests.