@smilodon/solid 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPLETE-GUIDE.md +617 -0
- package/README.md +227 -0
- package/dist/index.cjs +454 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +432 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Select.d.ts +79 -0
- package/dist/types/Select.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +34 -0
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
# @smilodon/solid - Complete Guide
|
|
2
|
+
|
|
3
|
+
**Production-ready, accessible Select component for SolidJS applications**
|
|
4
|
+
|
|
5
|
+
This guide explains how to install, configure, style, optimize, and troubleshoot the SolidJS adapter for Smilodon. It is intended to answer the full lifecycle of questions a Solid user typically has: simple setup, medium-complexity usage, and advanced production concerns.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
1. [Installation & Setup](#installation--setup)
|
|
12
|
+
2. [How the Solid adapter works](#how-the-solid-adapter-works)
|
|
13
|
+
3. [Basic Usage](#basic-usage)
|
|
14
|
+
4. [Controlled and Uncontrolled Modes](#controlled-and-uncontrolled-modes)
|
|
15
|
+
5. [Complete Props Reference](#complete-props-reference)
|
|
16
|
+
6. [Input Formats](#input-formats)
|
|
17
|
+
7. [Grouped Data](#grouped-data)
|
|
18
|
+
8. [Custom Renderers](#custom-renderers)
|
|
19
|
+
9. [Imperative Handle](#imperative-handle)
|
|
20
|
+
10. [Styling & Theming](#styling--theming)
|
|
21
|
+
11. [Performance Optimization](#performance-optimization)
|
|
22
|
+
12. [Accessibility](#accessibility)
|
|
23
|
+
13. [Diagnostics & Runtime Policies](#diagnostics--runtime-policies)
|
|
24
|
+
14. [Advanced Patterns](#advanced-patterns)
|
|
25
|
+
15. [Troubleshooting](#troubleshooting)
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Installation & Setup
|
|
30
|
+
|
|
31
|
+
### Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @smilodon/solid @smilodon/core solid-js
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
or with pnpm:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pnpm add @smilodon/solid @smilodon/core solid-js
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
or with yarn:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
yarn add @smilodon/solid @smilodon/core solid-js
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Vite / SolidStart notes
|
|
50
|
+
|
|
51
|
+
The adapter wraps the shared `enhanced-select` custom element and waits for the underlying runtime to be ready before syncing items, config, and selection. In most Solid projects, no extra compiler configuration is needed beyond your normal Solid setup.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import { defineConfig } from 'vite'
|
|
55
|
+
import solid from 'vite-plugin-solid'
|
|
56
|
+
|
|
57
|
+
export default defineConfig({
|
|
58
|
+
plugins: [solid()],
|
|
59
|
+
})
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### When to use `@smilodon/solid`
|
|
63
|
+
|
|
64
|
+
Use this adapter when you want:
|
|
65
|
+
|
|
66
|
+
- Solid-first props and callback ergonomics
|
|
67
|
+
- a callback `ref` handle for programmatic control
|
|
68
|
+
- JSX-based option rendering with Solid
|
|
69
|
+
- direct DOM option rendering where needed
|
|
70
|
+
- the same runtime behavior and styling model used by other Smilodon adapters
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## How the Solid adapter works
|
|
75
|
+
|
|
76
|
+
The Solid adapter does not re-implement selection behavior. Instead, it:
|
|
77
|
+
|
|
78
|
+
1. mounts an `enhanced-select` element,
|
|
79
|
+
2. waits for the custom element upgrade to complete,
|
|
80
|
+
3. syncs props into the runtime with `setItems()`, `setGroupedItems()`, `setSelectedValues()`, and `updateConfig()`,
|
|
81
|
+
4. forwards runtime events back into Solid callbacks,
|
|
82
|
+
5. optionally renders custom option content through Solid or raw DOM.
|
|
83
|
+
|
|
84
|
+
This design keeps framework wrappers thin and lets the shared runtime carry the complex logic for:
|
|
85
|
+
|
|
86
|
+
- virtualization
|
|
87
|
+
- search behavior
|
|
88
|
+
- keyboard navigation
|
|
89
|
+
- diagnostics
|
|
90
|
+
- limitation reporting
|
|
91
|
+
- clear control behavior
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Basic Usage
|
|
96
|
+
|
|
97
|
+
### Minimal example
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
import { render } from 'solid-js/web'
|
|
101
|
+
import { createSignal } from 'solid-js'
|
|
102
|
+
import { Select } from '@smilodon/solid'
|
|
103
|
+
|
|
104
|
+
function App() {
|
|
105
|
+
const [value, setValue] = createSignal<string | number>('')
|
|
106
|
+
|
|
107
|
+
return (
|
|
108
|
+
<Select
|
|
109
|
+
items={[
|
|
110
|
+
{ value: 'apple', label: 'Apple' },
|
|
111
|
+
{ value: 'banana', label: 'Banana' },
|
|
112
|
+
{ value: 'cherry', label: 'Cherry' },
|
|
113
|
+
]}
|
|
114
|
+
value={value()}
|
|
115
|
+
onChange={(next) => setValue(next as string)}
|
|
116
|
+
searchable
|
|
117
|
+
placeholder="Choose a fruit"
|
|
118
|
+
/>
|
|
119
|
+
)
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
render(() => <App />, document.getElementById('app')!)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Medium-complexity example
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { createMemo, createSignal } from 'solid-js'
|
|
129
|
+
import { Select } from '@smilodon/solid'
|
|
130
|
+
|
|
131
|
+
export default function TeamPicker() {
|
|
132
|
+
const [query, setQuery] = createSignal('')
|
|
133
|
+
const [value, setValue] = createSignal<Array<string | number>>([])
|
|
134
|
+
|
|
135
|
+
const items = createMemo(() =>
|
|
136
|
+
[
|
|
137
|
+
{ value: 'design', label: 'Design' },
|
|
138
|
+
{ value: 'engineering', label: 'Engineering' },
|
|
139
|
+
{ value: 'security', label: 'Security' },
|
|
140
|
+
{ value: 'operations', label: 'Operations' },
|
|
141
|
+
].filter((item) => item.label.toLowerCase().includes(query().toLowerCase()))
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
return (
|
|
145
|
+
<>
|
|
146
|
+
<input
|
|
147
|
+
value={query()}
|
|
148
|
+
onInput={(event) => setQuery(event.currentTarget.value)}
|
|
149
|
+
placeholder="Filter teams"
|
|
150
|
+
/>
|
|
151
|
+
|
|
152
|
+
<Select
|
|
153
|
+
items={items()}
|
|
154
|
+
value={value()}
|
|
155
|
+
onChange={(next) => setValue(next as Array<string | number>)}
|
|
156
|
+
multiple
|
|
157
|
+
searchable
|
|
158
|
+
clearable
|
|
159
|
+
placeholder="Choose teams"
|
|
160
|
+
/>
|
|
161
|
+
</>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Controlled and Uncontrolled Modes
|
|
169
|
+
|
|
170
|
+
### Controlled mode
|
|
171
|
+
|
|
172
|
+
Use controlled mode when your signal or store owns the selected value.
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
const [value, setValue] = createSignal<string | number>('')
|
|
176
|
+
|
|
177
|
+
<Select
|
|
178
|
+
items={items}
|
|
179
|
+
value={value()}
|
|
180
|
+
onChange={(next) => setValue(next as string)}
|
|
181
|
+
/>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Choose controlled mode when you need:
|
|
185
|
+
|
|
186
|
+
- form-state ownership outside the component
|
|
187
|
+
- persistence to a store or router state
|
|
188
|
+
- validation controlled by the host app
|
|
189
|
+
- analytics or synchronized multi-component workflows
|
|
190
|
+
|
|
191
|
+
### Uncontrolled mode
|
|
192
|
+
|
|
193
|
+
Use uncontrolled mode when you only need an initial value and want the component to manage selection internally.
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
<Select
|
|
197
|
+
items={items}
|
|
198
|
+
defaultValue="banana"
|
|
199
|
+
searchable
|
|
200
|
+
/>
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Choose uncontrolled mode when you want:
|
|
204
|
+
|
|
205
|
+
- simpler local setup
|
|
206
|
+
- less host-state wiring
|
|
207
|
+
- an easier drop-in component for small forms
|
|
208
|
+
|
|
209
|
+
### Guidance
|
|
210
|
+
|
|
211
|
+
- Prefer controlled mode for shared application state.
|
|
212
|
+
- Prefer uncontrolled mode for isolated local widgets.
|
|
213
|
+
- Avoid switching repeatedly between controlled and uncontrolled patterns for the same instance.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Complete Props Reference
|
|
218
|
+
|
|
219
|
+
### Primary props
|
|
220
|
+
|
|
221
|
+
| Prop | Type | Default | Description |
|
|
222
|
+
| --- | --- | --- | --- |
|
|
223
|
+
| `items` | `SelectItem[]` | `[]` | Flat item array |
|
|
224
|
+
| `groupedItems` | `GroupedItem[]` | `undefined` | Grouped option structure |
|
|
225
|
+
| `value` | `SelectValue` | `undefined` | Controlled selection |
|
|
226
|
+
| `defaultValue` | `SelectValue` | `undefined` | Uncontrolled initial selection |
|
|
227
|
+
| `multiple` | `boolean` | `false` | Multi-select mode |
|
|
228
|
+
| `searchable` | `boolean` | `false` | Search input enabled |
|
|
229
|
+
| `placeholder` | `string` | `undefined` | Placeholder text |
|
|
230
|
+
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
231
|
+
| `required` | `boolean` | `false` | Required state |
|
|
232
|
+
| `error` | `boolean` | `false` | Error state |
|
|
233
|
+
| `infiniteScroll` | `boolean` | `false` | Enable load-more behavior |
|
|
234
|
+
| `pageSize` | `number` | `50` | Infinite-scroll page size |
|
|
235
|
+
| `virtualized` | `boolean` | `true` | Virtualized option rendering |
|
|
236
|
+
| `maxSelections` | `number` | `undefined` | Maximum selection count in multi mode |
|
|
237
|
+
| `placement` | `'bottom' \| 'top' \| 'auto'` | `'auto'` | Dropdown placement |
|
|
238
|
+
| `clearable` | `boolean` | `false` | Show clear control |
|
|
239
|
+
| `clearSelectionOnClear` | `boolean` | `true` | Clear selected values when clear control is used |
|
|
240
|
+
| `clearSearchOnClear` | `boolean` | `true` | Clear search text when clear control is used |
|
|
241
|
+
| `clearAriaLabel` | `string` | `undefined` | Clear-button ARIA label |
|
|
242
|
+
| `clearIcon` | `string` | `undefined` | Clear-button icon text |
|
|
243
|
+
| `class` / `className` | `string` | `undefined` | Host class |
|
|
244
|
+
| `style` | `JSX.CSSProperties` | `undefined` | Host inline styles / CSS variables |
|
|
245
|
+
|
|
246
|
+
### Renderer props
|
|
247
|
+
|
|
248
|
+
| Prop | Type | Description |
|
|
249
|
+
| --- | --- | --- |
|
|
250
|
+
| `customRenderer` | `(item, index) => JSX.Element` | Render option content with Solid JSX |
|
|
251
|
+
| `optionRenderer` | `(item, index, helpers) => HTMLElement` | Render option content with raw DOM |
|
|
252
|
+
| `groupHeaderRenderer` | `(group, index) => JSX.Element` | Render grouped header content |
|
|
253
|
+
|
|
254
|
+
### Diagnostics and runtime-policy props
|
|
255
|
+
|
|
256
|
+
| Prop | Type | Description |
|
|
257
|
+
| --- | --- | --- |
|
|
258
|
+
| `trackingEnabled` | `boolean` | Enable runtime tracking |
|
|
259
|
+
| `trackEvents` | `boolean` | Track event history |
|
|
260
|
+
| `trackStyling` | `boolean` | Track styling updates |
|
|
261
|
+
| `trackLimitations` | `boolean` | Track limitation state changes |
|
|
262
|
+
| `emitDiagnostics` | `boolean` | Emit `diagnostic` events |
|
|
263
|
+
| `trackingMaxEntries` | `number` | Per-channel entry cap |
|
|
264
|
+
| `limitationPolicies` | `LimitationPolicyMap` | Apply runtime limitation policies |
|
|
265
|
+
| `autoMitigateRuntimeModeSwitch` | `boolean` | Auto-clear selection when switching between single and multi mode |
|
|
266
|
+
|
|
267
|
+
### Event callbacks
|
|
268
|
+
|
|
269
|
+
| Callback | Signature | Purpose |
|
|
270
|
+
| --- | --- | --- |
|
|
271
|
+
| `onChange` | `(value, items) => void` | Selection changed |
|
|
272
|
+
| `onSelect` | `(item, index) => void` | Item selected |
|
|
273
|
+
| `onOpen` | `() => void` | Dropdown opened |
|
|
274
|
+
| `onClose` | `() => void` | Dropdown closed |
|
|
275
|
+
| `onSearch` | `(query) => void` | Search changed |
|
|
276
|
+
| `onLoadMore` | `(page) => void` | Load more requested |
|
|
277
|
+
| `onCreate` | `(value) => void` | New option created |
|
|
278
|
+
| `onClear` | `(detail) => void` | Clear control used |
|
|
279
|
+
| `onDiagnostic` | `(detail) => void` | Diagnostic event emitted |
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Input Formats
|
|
284
|
+
|
|
285
|
+
### Object array
|
|
286
|
+
|
|
287
|
+
```tsx
|
|
288
|
+
const items = [
|
|
289
|
+
{ value: 'ir', label: 'Iran' },
|
|
290
|
+
{ value: 'jp', label: 'Japan' },
|
|
291
|
+
{ value: 'de', label: 'Germany' },
|
|
292
|
+
]
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Group-ready flat items
|
|
296
|
+
|
|
297
|
+
```tsx
|
|
298
|
+
const items = [
|
|
299
|
+
{ value: 'react', label: 'React', group: 'Frontend' },
|
|
300
|
+
{ value: 'solid', label: 'SolidJS', group: 'Frontend' },
|
|
301
|
+
{ value: 'android', label: 'Android', group: 'Mobile' },
|
|
302
|
+
]
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
The Solid adapter can normalize the `group` field into grouped runtime data automatically.
|
|
306
|
+
|
|
307
|
+
### Explicit grouped data
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
const groupedItems = [
|
|
311
|
+
{
|
|
312
|
+
label: 'Frontend',
|
|
313
|
+
options: [
|
|
314
|
+
{ value: 'react', label: 'React' },
|
|
315
|
+
{ value: 'solid', label: 'SolidJS' },
|
|
316
|
+
],
|
|
317
|
+
},
|
|
318
|
+
]
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
---
|
|
322
|
+
|
|
323
|
+
## Grouped Data
|
|
324
|
+
|
|
325
|
+
You can use grouped data in two ways:
|
|
326
|
+
|
|
327
|
+
1. pass `groupedItems` directly, or
|
|
328
|
+
2. pass flat `items` with a `group` property.
|
|
329
|
+
|
|
330
|
+
Use explicit `groupedItems` when your source data is already grouped. Use flat items when grouping is just a display concern.
|
|
331
|
+
|
|
332
|
+
---
|
|
333
|
+
|
|
334
|
+
## Custom Renderers
|
|
335
|
+
|
|
336
|
+
### Simple: JSX renderer
|
|
337
|
+
|
|
338
|
+
```tsx
|
|
339
|
+
<Select
|
|
340
|
+
items={items}
|
|
341
|
+
customRenderer={(item) => (
|
|
342
|
+
<div style={{ display: 'flex', 'justify-content': 'space-between' }}>
|
|
343
|
+
<span>{item.label}</span>
|
|
344
|
+
<strong>{String(item.value)}</strong>
|
|
345
|
+
</div>
|
|
346
|
+
)}
|
|
347
|
+
/>
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Medium: DOM renderer
|
|
351
|
+
|
|
352
|
+
```tsx
|
|
353
|
+
<Select
|
|
354
|
+
items={items}
|
|
355
|
+
optionRenderer={(item, index, helpers) => {
|
|
356
|
+
const el = document.createElement('div')
|
|
357
|
+
el.style.display = 'flex'
|
|
358
|
+
el.style.justifyContent = 'space-between'
|
|
359
|
+
el.innerHTML = `<span>${item.label}</span><small>#${index + 1}</small>`
|
|
360
|
+
el.onclick = () => helpers?.onSelect(item, index)
|
|
361
|
+
return el
|
|
362
|
+
}}
|
|
363
|
+
/>
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
### When to choose each renderer path
|
|
367
|
+
|
|
368
|
+
- use `customRenderer` when you want Solid JSX and composability
|
|
369
|
+
- use `optionRenderer` when you need direct DOM control or integration with non-Solid rendering primitives
|
|
370
|
+
- keep renderers lightweight for large datasets
|
|
371
|
+
|
|
372
|
+
---
|
|
373
|
+
|
|
374
|
+
## Imperative Handle
|
|
375
|
+
|
|
376
|
+
The Solid adapter exposes a callback `ref` instead of React-style ref forwarding.
|
|
377
|
+
|
|
378
|
+
```tsx
|
|
379
|
+
let api
|
|
380
|
+
|
|
381
|
+
<Select
|
|
382
|
+
items={items}
|
|
383
|
+
ref={(handle) => {
|
|
384
|
+
api = handle
|
|
385
|
+
}}
|
|
386
|
+
/>
|
|
387
|
+
|
|
388
|
+
<button onClick={() => api?.open()}>Open</button>
|
|
389
|
+
<button onClick={() => api?.clear()}>Clear</button>
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
Available methods:
|
|
393
|
+
|
|
394
|
+
- `focus()`
|
|
395
|
+
- `open()`
|
|
396
|
+
- `close()`
|
|
397
|
+
- `getSelectedItems()`
|
|
398
|
+
- `getSelectedValues()`
|
|
399
|
+
- `setItems()`
|
|
400
|
+
- `setGroupedItems()`
|
|
401
|
+
- `clear()`
|
|
402
|
+
- `getCapabilities()`
|
|
403
|
+
- `getKnownLimitations()`
|
|
404
|
+
- `getTrackingSnapshot()`
|
|
405
|
+
- `clearTracking()`
|
|
406
|
+
- `setLimitationPolicies()`
|
|
407
|
+
|
|
408
|
+
Use the imperative handle when you need integration with:
|
|
409
|
+
|
|
410
|
+
- dialogs and popovers
|
|
411
|
+
- external reset buttons
|
|
412
|
+
- data refresh flows
|
|
413
|
+
- observability dashboards
|
|
414
|
+
|
|
415
|
+
---
|
|
416
|
+
|
|
417
|
+
## Styling & Theming
|
|
418
|
+
|
|
419
|
+
The Solid adapter uses the same styling system as the shared runtime.
|
|
420
|
+
|
|
421
|
+
### Main styling mechanisms
|
|
422
|
+
|
|
423
|
+
- CSS variables such as `--select-input-*`, `--select-dropdown-*`, and `--select-option-*`
|
|
424
|
+
- shadow parts such as `::part(button)`, `::part(listbox)`, `::part(option)`, `::part(chip)`, and `::part(clear-button)`
|
|
425
|
+
- host classes via `class` or `className`
|
|
426
|
+
- custom renderers for deeper option markup control
|
|
427
|
+
|
|
428
|
+
### Example
|
|
429
|
+
|
|
430
|
+
```tsx
|
|
431
|
+
<Select
|
|
432
|
+
items={items}
|
|
433
|
+
style={{
|
|
434
|
+
'--select-accent': '#2563eb',
|
|
435
|
+
'--select-border-focus': '#2563eb',
|
|
436
|
+
'--select-input-min-height': '52px',
|
|
437
|
+
} as JSX.CSSProperties}
|
|
438
|
+
/>
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
Reference docs:
|
|
442
|
+
|
|
443
|
+
- [../../docs/STYLING.md](../../docs/STYLING.md)
|
|
444
|
+
- [../../docs/STYLING-TOKENS.md](../../docs/STYLING-TOKENS.md)
|
|
445
|
+
- [../../docs/STYLING-EXAMPLES.md](../../docs/STYLING-EXAMPLES.md)
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
## Performance Optimization
|
|
450
|
+
|
|
451
|
+
### Simple guidance
|
|
452
|
+
|
|
453
|
+
- leave `virtualized` enabled for medium and large datasets
|
|
454
|
+
- keep `items` stable when possible
|
|
455
|
+
- avoid heavy per-row DOM in very large lists
|
|
456
|
+
|
|
457
|
+
### Medium guidance
|
|
458
|
+
|
|
459
|
+
- if rows have consistent height, keep the visual design consistent so virtualization remains accurate
|
|
460
|
+
- avoid rebuilding arrays unnecessarily during unrelated reactivity updates
|
|
461
|
+
- keep renderer output minimal for 10K+ item lists
|
|
462
|
+
|
|
463
|
+
### Advanced guidance
|
|
464
|
+
|
|
465
|
+
- use plain items with lightweight labels for the fastest path
|
|
466
|
+
- prefer DOM renderer or plain runtime rendering over very heavy JSX per option when list size is extreme
|
|
467
|
+
- profile host state churn as well as select rendering; Solid reactivity can be fast, but unnecessary signal fan-out still costs time
|
|
468
|
+
|
|
469
|
+
See [../../docs/PERFORMANCE.md](../../docs/PERFORMANCE.md).
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## Accessibility
|
|
474
|
+
|
|
475
|
+
The Solid adapter inherits the shared accessibility model from the runtime.
|
|
476
|
+
|
|
477
|
+
Support includes:
|
|
478
|
+
|
|
479
|
+
- ARIA listbox semantics
|
|
480
|
+
- keyboard navigation
|
|
481
|
+
- active-item announcements
|
|
482
|
+
- clear-button labelling
|
|
483
|
+
- touch target sizing hooks
|
|
484
|
+
- reduced-motion and high-contrast support
|
|
485
|
+
|
|
486
|
+
Recommended host patterns:
|
|
487
|
+
|
|
488
|
+
- connect labels with `aria-labelledby` where needed
|
|
489
|
+
- provide descriptive placeholder and helper text
|
|
490
|
+
- keep custom renderers semantically simple
|
|
491
|
+
- test screen-reader flows when using advanced option rendering
|
|
492
|
+
|
|
493
|
+
---
|
|
494
|
+
|
|
495
|
+
## Diagnostics & Runtime Policies
|
|
496
|
+
|
|
497
|
+
Smilodon supports runtime capability inspection and limitation-policy management.
|
|
498
|
+
|
|
499
|
+
### Example
|
|
500
|
+
|
|
501
|
+
```tsx
|
|
502
|
+
<Select
|
|
503
|
+
items={items}
|
|
504
|
+
trackingEnabled
|
|
505
|
+
emitDiagnostics
|
|
506
|
+
onDiagnostic={(detail) => console.log(detail)}
|
|
507
|
+
/>
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
### What you can inspect
|
|
511
|
+
|
|
512
|
+
- capability reports via `getCapabilities()`
|
|
513
|
+
- machine-readable known limitations via `getKnownLimitations()`
|
|
514
|
+
- tracking history via `getTrackingSnapshot()`
|
|
515
|
+
- policy state via `setLimitationPolicies()`
|
|
516
|
+
|
|
517
|
+
Use this for:
|
|
518
|
+
|
|
519
|
+
- QA instrumentation
|
|
520
|
+
- support dashboards
|
|
521
|
+
- controlled rollouts
|
|
522
|
+
- runtime policy enforcement
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## Advanced Patterns
|
|
527
|
+
|
|
528
|
+
### 1. External filtering + internal selection
|
|
529
|
+
|
|
530
|
+
```tsx
|
|
531
|
+
const [query, setQuery] = createSignal('')
|
|
532
|
+
const filtered = createMemo(() => allItems.filter((item) => item.label.includes(query())))
|
|
533
|
+
|
|
534
|
+
<Select items={filtered()} searchable />
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### 2. Large grouped dataset
|
|
538
|
+
|
|
539
|
+
```tsx
|
|
540
|
+
<Select
|
|
541
|
+
groupedItems={groupedItems}
|
|
542
|
+
multiple
|
|
543
|
+
searchable
|
|
544
|
+
virtualized
|
|
545
|
+
maxSelections={10}
|
|
546
|
+
/>
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
### 3. Diagnostics-enabled admin picker
|
|
550
|
+
|
|
551
|
+
```tsx
|
|
552
|
+
let api
|
|
553
|
+
|
|
554
|
+
<Select
|
|
555
|
+
items={items}
|
|
556
|
+
trackingEnabled
|
|
557
|
+
emitDiagnostics
|
|
558
|
+
ref={(handle) => (api = handle)}
|
|
559
|
+
/>
|
|
560
|
+
|
|
561
|
+
<button onClick={() => console.log(api?.getTrackingSnapshot())}>Inspect</button>
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
## Troubleshooting
|
|
567
|
+
|
|
568
|
+
### The dropdown renders but items do not appear
|
|
569
|
+
|
|
570
|
+
Check that:
|
|
571
|
+
|
|
572
|
+
- `items` or `groupedItems` are actually populated
|
|
573
|
+
- your data shape uses `value` and `label`
|
|
574
|
+
- you are not accidentally clearing items during a reactive update
|
|
575
|
+
|
|
576
|
+
### Custom rendering behaves unexpectedly
|
|
577
|
+
|
|
578
|
+
Check that:
|
|
579
|
+
|
|
580
|
+
- `customRenderer` returns lightweight JSX
|
|
581
|
+
- `optionRenderer` returns an `HTMLElement`
|
|
582
|
+
- renderer logic does not mutate shared external DOM unexpectedly
|
|
583
|
+
|
|
584
|
+
### Selection does not update as expected
|
|
585
|
+
|
|
586
|
+
Check that:
|
|
587
|
+
|
|
588
|
+
- controlled mode writes the new value back into the signal
|
|
589
|
+
- uncontrolled mode uses `defaultValue`, not `value`
|
|
590
|
+
- multi-select values are arrays
|
|
591
|
+
|
|
592
|
+
### Large lists feel slow
|
|
593
|
+
|
|
594
|
+
Check that:
|
|
595
|
+
|
|
596
|
+
- `virtualized` is still enabled
|
|
597
|
+
- renderer output is not too heavy
|
|
598
|
+
- item arrays are not being recreated unnecessarily
|
|
599
|
+
|
|
600
|
+
### Diagnostics are missing
|
|
601
|
+
|
|
602
|
+
Check that:
|
|
603
|
+
|
|
604
|
+
- `trackingEnabled` is true
|
|
605
|
+
- `emitDiagnostics` is true if you expect runtime `diagnostic` events
|
|
606
|
+
- you are listening to `onDiagnostic`
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
## Related documentation
|
|
611
|
+
|
|
612
|
+
- [../../README.md](../../README.md)
|
|
613
|
+
- [../../ARCHITECTURE.md](../../ARCHITECTURE.md)
|
|
614
|
+
- [../../docs/ADAPTER-CAPABILITY-MATRIX.md](../../docs/ADAPTER-CAPABILITY-MATRIX.md)
|
|
615
|
+
- [../../docs/KNOWN-LIMITATIONS.md](../../docs/KNOWN-LIMITATIONS.md)
|
|
616
|
+
- [../../docs/PERFORMANCE.md](../../docs/PERFORMANCE.md)
|
|
617
|
+
- [../../docs/STYLING.md](../../docs/STYLING.md)
|