Skip to content

Commit 7465bdd

Browse files
committed
docs(focus-zone): address review feedback
1 parent a0d2c3b commit 7465bdd

1 file changed

Lines changed: 34 additions & 22 deletions

File tree

docs/widgets/focus-zone.md

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ Groups focusable widgets into a logical unit for Tab traversal. Focus zones help
88
ui.focusZone(
99
{ id: "toolbar", tabIndex: 0 },
1010
[
11-
ui.button({ id: "new", label: "New" }),
12-
ui.button({ id: "open", label: "Open" }),
13-
ui.button({ id: "save", label: "Save" }),
11+
ui.row({ gap: 1 }, [
12+
ui.button({ id: "new", label: "New" }),
13+
ui.button({ id: "open", label: "Open" }),
14+
ui.button({ id: "save", label: "Save" }),
15+
]),
1416
]
1517
)
1618
```
@@ -61,9 +63,11 @@ Arrow keys move through items in document order:
6163

6264
```typescript
6365
ui.focusZone({ id: "list", navigation: "linear" }, [
64-
ui.button({ id: "a", label: "A" }),
65-
ui.button({ id: "b", label: "B" }),
66-
ui.button({ id: "c", label: "C" }),
66+
ui.column({ gap: 1 }, [
67+
ui.button({ id: "a", label: "A" }),
68+
ui.button({ id: "b", label: "B" }),
69+
ui.button({ id: "c", label: "C" }),
70+
]),
6771
])
6872
// Up/Down or Left/Right moves A -> B -> C
6973
```
@@ -74,12 +78,14 @@ Arrow keys navigate a 2D grid layout:
7478

7579
```typescript
7680
ui.focusZone({ id: "grid", navigation: "grid", columns: 3 }, [
77-
ui.button({ id: "1", label: "1" }),
78-
ui.button({ id: "2", label: "2" }),
79-
ui.button({ id: "3", label: "3" }),
80-
ui.button({ id: "4", label: "4" }),
81-
ui.button({ id: "5", label: "5" }),
82-
ui.button({ id: "6", label: "6" }),
81+
ui.grid({ columns: 3 }, [
82+
ui.button({ id: "1", label: "1" }),
83+
ui.button({ id: "2", label: "2" }),
84+
ui.button({ id: "3", label: "3" }),
85+
ui.button({ id: "4", label: "4" }),
86+
ui.button({ id: "5", label: "5" }),
87+
ui.button({ id: "6", label: "6" }),
88+
]),
8389
])
8490
// Left/Right moves horizontally
8591
// Up/Down moves between rows
@@ -116,8 +122,10 @@ ui.focusZone({
116122
onEnter: () => showSearchHint(),
117123
onExit: () => hideSearchHint(),
118124
}, [
119-
ui.input({ id: "query", value: state.query }),
120-
ui.button({ id: "search", label: "Search" }),
125+
ui.row({ gap: 1 }, [
126+
ui.input({ id: "query", value: state.query }),
127+
ui.button({ id: "search", label: "Search" }),
128+
]),
121129
])
122130
```
123131

@@ -128,17 +136,21 @@ Organize a form into logical sections:
128136
```typescript
129137
ui.column({ gap: 2 }, [
130138
ui.focusZone({ id: "credentials", tabIndex: 0 }, [
131-
ui.field({ label: "Username", children:
132-
ui.input({ id: "user", value: state.user })
133-
}),
134-
ui.field({ label: "Password", children:
135-
ui.input({ id: "pass", value: state.pass })
136-
}),
139+
ui.column({ gap: 1 }, [
140+
ui.field({ label: "Username", children:
141+
ui.input({ id: "user", value: state.user })
142+
}),
143+
ui.field({ label: "Password", children:
144+
ui.input({ id: "pass", value: state.pass })
145+
}),
146+
]),
137147
]),
138148

139149
ui.focusZone({ id: "actions", tabIndex: 1 }, [
140-
ui.button({ id: "login", label: "Login" }),
141-
ui.button({ id: "cancel", label: "Cancel" }),
150+
ui.row({ gap: 1 }, [
151+
ui.button({ id: "login", label: "Login" }),
152+
ui.button({ id: "cancel", label: "Cancel" }),
153+
]),
142154
]),
143155
])
144156
```

0 commit comments

Comments
 (0)