fix(appkit-ui): remove stray focus ring on Command input and menu items - #494
Open
pkosiec wants to merge 2 commits into
Open
fix(appkit-ui): remove stray focus ring on Command input and menu items#494pkosiec wants to merge 2 commits into
pkosiec wants to merge 2 commits into
Conversation
A global `:focus-visible` rule in globals.css paints a box-shadow ring on every keyboard-focused element. It lives in @layer base, so components with their own `focus-visible:ring-*` (Input, Button, Select, ...) override it via @layer utilities and look correct. Bare focusables with no own ring — CommandInput and dropdown/context/menubar item slots — fall through to the global rule and show an unexpected double-line ring absent from upstream shadcn (which deliberately gives these no ring). Add `focus-visible:shadow-none` to those slots so they match shadcn. `shadow-none` emits a raw box-shadow utility that overrides the base-layer rule; `ring-0` would not, since it only sets --tw-ring-shadow. The global rule is intentionally left intact for other bare focusables. Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
Contributor
📦 Bundle size reportCompared against
|
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 791 KB | 276 KB |
| Type declarations | 285 KB | 97 KB |
| Source maps | 1.5 MB | 515 KB |
| Other | 11 KB | 3.7 KB |
| Total | 2.6 MB | 892 KB |
Per-entry composition (own code — deps external (as shipped))
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
. |
86 KB | 2.5 KB | 89 KB | external | 281 KB |
./beta |
40 KB | 231 B | 40 KB | external | 119 KB |
./type-generator |
19 KB | 0 B | 19 KB | external | 54 KB |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
. |
index.js |
initial | 82 KB |
. |
utils.js |
initial | 4.0 KB |
. |
remote-tunnel-manager.js |
lazy | 2.5 KB |
./beta |
beta.js |
initial | 30 KB |
./beta |
databricks.js |
initial | 5.8 KB |
./beta |
service-context.js |
initial | 3.2 KB |
./beta |
client-options.js |
initial | 220 B |
./beta |
databricks.js |
lazy | 128 B |
./beta |
index.js |
lazy | 103 B |
./type-generator |
index.js |
initial | 19 KB |
@databricks/appkit-ui
npm tarball (packed): 305 KB (+101 B) — gzipped download (dist + bin; excludes release-only docs/NOTICE).
| dist | raw | gzip |
|---|---|---|
| JS (runtime) | 360 KB (+390 B) | 119 KB (+60 B) |
| Type declarations | 205 KB | 74 KB |
| Source maps | 686 KB (+390 B) | 224 KB (+66 B) |
| CSS | 16 KB | 3.3 KB |
| Total | 1.2 MB (+780 B) | 422 KB (+126 B) |
Per-entry composition (consumer bundle — deps bundled, peerDeps external)
| Entry | Initial (gz) | Lazy (gz) | Total (gz) | node_modules (min) | Own code (min) |
|---|---|---|---|---|---|
./js |
4.3 KB | 49 KB | 54 KB | 208 KB | 12 KB |
./js/beta |
20 B | 0 B | 20 B | 0 B | 0 B |
./react |
429 KB (+55 B) | 49 KB | 478 KB (+55 B) | 1.3 MB | 168 KB (+390 B) |
./react/beta |
20 B | 0 B | 20 B | 0 B | 0 B |
Chunks:
| Entry | Chunk | Load | Size (gz) |
|---|---|---|---|
./js |
index.js |
initial | 4.2 KB |
./js |
chunk |
initial | 120 B |
./js |
apache-arrow |
lazy | 49 KB |
./js/beta |
beta.js |
initial | 20 B |
./react |
index.js |
initial | 427 KB |
./react |
tslib |
initial | 2.1 KB |
./react |
apache-arrow |
lazy | 49 KB |
./react/beta |
beta.js |
initial | 20 B |
Contributor
🤖 AppKit PR bot🔬 Run evalsStart an eval for this PR from the evals-monitor app: Go to Evals Monitor → 📦 Try this PR's app templateScaffolds a new app from this PR's SDK build. Run it in any folder (requires the GitHub CLI — gh run download 30355015433 -R databricks/appkit -n appkit-template-0.48.0-pr.9e5ef72-pkosiec-fix-command-border-494 -D appkit-pr-494 \
&& unzip -o "appkit-pr-494/appkit-template-0.48.0-pr.9e5ef72-pkosiec-fix-command-border-494.zip" -d "appkit-pr-494" \
&& databricks apps init --template "appkit-pr-494"The template pins |
SelectItem used the same background-based focus pattern as the menu components (focus:bg-accent + outline-hidden) without cancelling the global :focus-visible box-shadow, leaving a stray ring on keyboard navigation. Add focus-visible:shadow-none to match the menu fix. Signed-off-by: Pawel Kosiec <pawel.kosiec@databricks.com>
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.
Problem
Command's search input and the item slots inDropdownMenu,ContextMenu, andMenubarshow an unexpected focus ring on keyboard focus — a double outline not present in upstream shadcn.Reported by Ivan here: https://databricks.slack.com/archives/C079XV741BQ/p1785174428544209
Cause
A global
:focus-visiblerule inglobals.csspaints abox-shadowring on every keyboard-focused element:It sits in
@layer base. Components with their ownfocus-visible:ring-*(Input, Button, Select, …) are in@layer utilitiesand override it, so they look correct. The command input and menu items have no ring of their own, so they fall through to the global rule. Upstream shadcn gives these elements no ring.Fix
Add
focus-visible:shadow-noneto those slots so they match shadcn. Menu items keep theirfocus:bg-accenthighlight. The global rule is left untouched, so every other focusable keeps its ring.shadow-noneis required overring-0: it emits a rawbox-shadowthat overrides the base rule, whereasring-0only sets--tw-ring-shadowand leaves the box-shadow in place.Screenshots
This pull request and its description were written by Isaac.