@adia-ai/web-components 0.6.44 → 0.6.45

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/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog — @adia-ai/web-components
2
2
 
3
+ ## [0.6.45] — 2026-05-29
4
+
5
+ ### Fixed — `<canvas-ui>` lazy `a2ui-root` import uses a bare specifier (FEEDBACK-85, follow-up to FB-81)
6
+
7
+ - **`components/canvas/canvas.js`** — the FB-81 lazy import used a *relative* cross-package path (`../../../web-modules/runtime/a2ui-root/a2ui-root.js`). That resolves from the real `node_modules` location but breaks once Vite pre-bundles `web-components` into `node_modules/.vite/deps/` — `vite:import-analysis` fails to resolve the relative path (even with `/* @vite-ignore */`) and aborts dep optimization, so the app won't boot (blank page, Vite overlay only). Switched to a **bare specifier** `import('@adia-ai/web-modules/runtime/a2ui-root')`, which resolves identically whether `web-components` is pre-bundled or not (via web-modules' `./runtime/*` export). **`@adia-ai/web-modules` is now declared as an `optionalDependency`** (`^0.6.0`) so the specifier resolves under any bundler; the import stays dynamic + `.catch()`-guarded, so it's loaded only when `<canvas-ui>` is used and degrades gracefully if web-modules is genuinely absent. Lockfile regen (`npm install --package-lock-only`) required at the release cut.
8
+
9
+ ### Fixed — `<select-ui>` derives an accessible name from `placeholder` (FEEDBACK-88)
10
+
11
+ - **`components/select/select.class.js`** — a placeholder-only `<select-ui placeholder="Status">` (no `label`/`aria-label`/`<field-ui>`) had **no accessible name** (WCAG 4.1.2 fail), while the sibling `<input-ui>` names itself from its placeholder. Added `#syncAccessibleName()` (run in `render()`) mirroring input-ui: derive `aria-label` from `placeholder` when the select is otherwise unnamed. **Guards** (a placeholder-only fix must not clobber a real label): an author `aria-label`, a visible `label`, or `aria-labelledby` always win; the **default `'Select...'` prompt is never used as a name** — otherwise every `<field-ui>`-wrapped select (named via a sibling `<label for>`, which `aria-label` would override) would be renamed to the generic prompt. A `#placeholderNamed` flag tracks the derived name so re-renders refresh/clear it without touching an author's aria-label. +5 unit tests. Known residual (matches input-ui): a `<field-ui>` + a *custom* placeholder on the same select still yields an aria-label from the placeholder — an unusual author combo.
12
+
13
+ ### Maintenance
14
+
15
+ - **`package.json`** — `@adia-ai/web-modules` added as an `optionalDependency` (`^0.6.0`) for the FB-85 bare-specifier resolution; lockfile regenerated.
16
+ - **`dist/web-components.min.js` + `dist/icons-manifest.js`** — bundle rebuild reflecting the `canvas.js` + `select.class.js` fixes above.
17
+
3
18
  ## [0.6.44] — 2026-05-28
4
19
 
5
20
  ### Fixed — `<canvas-ui>` no longer hard-requires `@adia-ai/web-modules` at build time (FEEDBACK-81)
@@ -1,9 +1,16 @@
1
1
  import { UIElement } from '../../core/element.js';
2
2
  // NOTE: the A2UI renderer (<a2ui-root>) lives in @adia-ai/web-modules and is
3
3
  // loaded lazily + guarded inside #ensureRenderer() (kicked off from connected()).
4
- // It is deliberately NOT a static import: @adia-ai/web-components declares no
5
- // dependency on @adia-ai/web-modules, so a static cross-package import hard-fails
6
- // the build for primitives-only consumers who never use <canvas-ui> (FEEDBACK-81).
4
+ // Two constraints shape this import:
5
+ // NOT static (FEEDBACK-81): a static cross-package import hard-fails the build
6
+ // for primitives-only consumers who never use <canvas-ui>. Hence lazy import().
7
+ // • BARE specifier, not a relative path (FEEDBACK-85): a relative
8
+ // '../../../web-modules/…' breaks Vite dep pre-bundling — once web-components is
9
+ // flattened into node_modules/.vite/deps/, the relative path no longer resolves
10
+ // and import-analysis aborts (even with @vite-ignore). A bare specifier resolves
11
+ // identically whether pre-bundled or not. @adia-ai/web-modules is declared as an
12
+ // optionalDependency so it resolves; the .catch() below degrades gracefully if
13
+ // it is genuinely absent at runtime.
7
14
 
8
15
  /**
9
16
  * <canvas-ui> — A2UI rendering surface.
@@ -102,7 +109,7 @@ export class UICanvas extends UIElement {
102
109
  this.#rendererReady = Promise.resolve(true);
103
110
  return this.#rendererReady;
104
111
  }
105
- this.#rendererReady = import(/* @vite-ignore */ '../../../web-modules/runtime/a2ui-root/a2ui-root.js')
112
+ this.#rendererReady = import('@adia-ai/web-modules/runtime/a2ui-root')
106
113
  .then(() => customElements.whenDefined('a2ui-root'))
107
114
  .then(() => true)
108
115
  .catch((err) => {
@@ -324,6 +324,37 @@ export class UISelect extends UIFormElement {
324
324
  else this.selectAllOptions();
325
325
  };
326
326
 
327
+ // FB-88: tracks whether the host's current aria-label was derived from
328
+ // `placeholder` (vs author-supplied), so re-renders refresh/clear OUR name
329
+ // without ever clobbering an author's aria-label.
330
+ #placeholderNamed = false;
331
+
332
+ /**
333
+ * Derive an accessible name from `placeholder` when the select is otherwise
334
+ * unnamed — mirrors input-ui so a placeholder-only select (the idiomatic
335
+ * filter-bar shape) still has a name for assistive tech (WCAG 4.1.2, FB-88).
336
+ *
337
+ * Guards (a placeholder-only fix must NOT clobber a real label):
338
+ * • an author `aria-label`, a visible `label`, or an `aria-labelledby` wins;
339
+ * • the default 'Select...' prompt is NOT used as a name — otherwise every
340
+ * field-ui-wrapped select (named by a sibling `<label for>`, which aria-label
341
+ * would override) would be renamed to the generic prompt.
342
+ */
343
+ #syncAccessibleName() {
344
+ const DEFAULT_PLACEHOLDER = 'Select...'; // matches static properties.placeholder.default
345
+ const authoredAria = this.hasAttribute('aria-label') && !this.#placeholderNamed;
346
+ const labeledElsewhere = !!this.label || this.hasAttribute('aria-labelledby');
347
+ const namable = !authoredAria && !labeledElsewhere
348
+ && this.placeholder && this.placeholder !== DEFAULT_PLACEHOLDER;
349
+ if (namable) {
350
+ this.setAttribute('aria-label', this.placeholder);
351
+ this.#placeholderNamed = true;
352
+ } else if (this.#placeholderNamed) {
353
+ this.removeAttribute('aria-label');
354
+ this.#placeholderNamed = false;
355
+ }
356
+ }
357
+
327
358
  connected() {
328
359
  super.connected();
329
360
  this.setAttribute('role', 'combobox');
@@ -349,6 +380,10 @@ export class UISelect extends UIFormElement {
349
380
  if (this.multiple) this.setAttribute('data-multi-chips', '');
350
381
  else this.removeAttribute('data-multi-chips');
351
382
 
383
+ // A11y (FB-88): name a placeholder-only select from its placeholder, like
384
+ // input-ui, so it isn't unnamed for assistive tech (WCAG 4.1.2).
385
+ this.#syncAccessibleName();
386
+
352
387
  // Stamp default trigger if none provided
353
388
  if (!this.querySelector('[slot="trigger"]')) {
354
389
  // Detach listbox before innerHTML wipe so it isn't destroyed
@@ -288,4 +288,38 @@ describe('select-ui', () => {
288
288
  await tick();
289
289
  expect(s.value).toBe('b');
290
290
  });
291
+
292
+ // §FB-88 — placeholder-only select derives an accessible name (WCAG 4.1.2),
293
+ // mirroring input-ui, without clobbering a real label.
294
+ describe('accessible name from placeholder (FB-88)', () => {
295
+ it('names a placeholder-only select from its placeholder', async () => {
296
+ const s = mount(`<select-ui placeholder="Status"></select-ui>`);
297
+ await tick();
298
+ expect(s.getAttribute('aria-label')).toBe('Status');
299
+ });
300
+
301
+ it('does NOT derive a name from the default "Select..." placeholder', async () => {
302
+ const s = mount(`<select-ui></select-ui>`);
303
+ await tick();
304
+ expect(s.hasAttribute('aria-label')).toBe(false);
305
+ });
306
+
307
+ it('preserves an author-supplied aria-label (override wins over placeholder)', async () => {
308
+ const s = mount(`<select-ui aria-label="Filter by status" placeholder="Status"></select-ui>`);
309
+ await tick();
310
+ expect(s.getAttribute('aria-label')).toBe('Filter by status');
311
+ });
312
+
313
+ it('does not set aria-label when a visible label is present', async () => {
314
+ const s = mount(`<select-ui label="Status" placeholder="Pick one"></select-ui>`);
315
+ await tick();
316
+ expect(s.hasAttribute('aria-label')).toBe(false);
317
+ });
318
+
319
+ it('does not set aria-label when aria-labelledby is present (e.g. field-ui)', async () => {
320
+ const s = mount(`<select-ui aria-labelledby="ext-label" placeholder="Pick one"></select-ui>`);
321
+ await tick();
322
+ expect(s.hasAttribute('aria-label')).toBe(false);
323
+ });
324
+ });
291
325
  });