anentrypoint-design 0.0.320 → 0.0.321

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anentrypoint-design",
3
- "version": "0.0.320",
3
+ "version": "0.0.321",
4
4
  "description": "247420 design system SDK — webjsx + modified ripple-ui, single-file ESM bundle for reproducible use of the AnEntrypoint design.",
5
5
  "type": "module",
6
6
  "main": "./dist/247420.js",
@@ -74,6 +74,8 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
74
74
  brandEl.textContent = brand;
75
75
 
76
76
  const appsBtn = makeBtn(icons.apps, 'apps', 'apps');
77
+ appsBtn.setAttribute('aria-haspopup', 'menu');
78
+ appsBtn.setAttribute('aria-expanded', 'false');
77
79
  const newInstBtn = onNewInstance ? makeBtn(icons.plus, 'instance', 'add') : null;
78
80
 
79
81
  const instSwitch = document.createElement('div');
@@ -94,17 +96,29 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
94
96
 
95
97
  const appsMenu = document.createElement('div');
96
98
  appsMenu.className = 'os-menu';
99
+ appsMenu.setAttribute('role', 'menu');
100
+ appsMenu.setAttribute('aria-label', 'Apps');
97
101
 
98
102
  const sideRail = document.createElement('div');
99
103
  sideRail.className = 'os-side-rail';
104
+ sideRail.setAttribute('role', 'navigation');
105
+ sideRail.setAttribute('aria-label', 'App launcher rail');
100
106
 
101
107
  const drawer = document.createElement('div');
102
108
  drawer.className = 'os-drawer';
103
109
  drawer.setAttribute('aria-hidden', 'true');
110
+ // Full-screen overlay that traps the user's attention while open — the
111
+ // dialog role + aria-modal + aria-labelledby give a screen reader the
112
+ // same "you are now in a dialog named X" announcement a sighted user
113
+ // gets from the visual takeover.
114
+ drawer.setAttribute('role', 'dialog');
115
+ drawer.setAttribute('aria-modal', 'true');
116
+ drawer.setAttribute('aria-labelledby', 'os-drawer-title');
104
117
  const drawerHeader = document.createElement('div');
105
118
  drawerHeader.className = 'os-drawer-head';
106
119
  const drawerTitle = document.createElement('span');
107
120
  drawerTitle.className = 'os-drawer-title';
121
+ drawerTitle.id = 'os-drawer-title';
108
122
  drawerTitle.textContent = 'apps';
109
123
  const drawerClose = document.createElement('button');
110
124
  drawerClose.className = 'os-drawer-close';
@@ -121,6 +135,7 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
121
135
  for (const app of apps) {
122
136
  const iconSvg = app.icon || icons[app.id] || '';
123
137
  const menuBtn = makeBtn(iconSvg, app.name);
138
+ menuBtn.setAttribute('role', 'menuitem');
124
139
  menuBtn.addEventListener('click', () => { closeMenu(); openApp(app.id); });
125
140
  appsMenu.appendChild(menuBtn);
126
141
 
@@ -143,16 +158,40 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
143
158
 
144
159
  const taskbar = document.createElement('div');
145
160
  taskbar.className = 'os-taskbar';
161
+ // Taskbar contents are rebuilt on a 500ms poll whenever windows open/
162
+ // close/gain focus (refreshTaskbar below); aria-live announces those
163
+ // additions/removals to a screen reader, which otherwise gets no signal
164
+ // that the running-window list changed. "polite" so it never interrupts.
165
+ taskbar.setAttribute('role', 'toolbar');
166
+ taskbar.setAttribute('aria-label', 'Open windows');
167
+ taskbar.setAttribute('aria-live', 'polite');
168
+ taskbar.setAttribute('aria-relevant', 'additions removals');
146
169
 
147
170
  osRoot.append(menubar, appsMenu, taskbar);
148
171
  document.body.append(sideRail, drawer);
149
172
 
150
- function openMenu() { appsMenu.classList.add('open'); }
151
- function closeMenu() { appsMenu.classList.remove('open'); }
152
- function openDrawer() { drawer.classList.add('open'); drawer.setAttribute('aria-hidden', 'false'); }
153
- function closeDrawer() { drawer.classList.remove('open'); drawer.setAttribute('aria-hidden', 'true'); }
173
+ function openMenu() { appsMenu.classList.add('open'); appsBtn.setAttribute('aria-expanded', 'true'); }
174
+ function closeMenu() { appsMenu.classList.remove('open'); appsBtn.setAttribute('aria-expanded', 'false'); }
175
+ // Focus management: opening the drawer moves keyboard focus onto its
176
+ // close button (the first reachable control inside the now-visible
177
+ // dialog) so Tab starts inside it, not lost on a now-hidden ancestor;
178
+ // closing restores focus to whichever element opened it (homeBtn is the
179
+ // only trigger today) so the user's keyboard position isn't lost.
180
+ let drawerReturnFocus = null;
181
+ function openDrawer() {
182
+ drawerReturnFocus = document.activeElement;
183
+ drawer.classList.add('open');
184
+ drawer.setAttribute('aria-hidden', 'false');
185
+ drawerClose.focus();
186
+ }
187
+ function closeDrawer() {
188
+ drawer.classList.remove('open');
189
+ drawer.setAttribute('aria-hidden', 'true');
190
+ if (drawerReturnFocus && typeof drawerReturnFocus.focus === 'function') drawerReturnFocus.focus();
191
+ drawerReturnFocus = null;
192
+ }
154
193
 
155
- appsBtn.addEventListener('click', e => { e.stopPropagation(); appsMenu.classList.toggle('open'); });
194
+ appsBtn.addEventListener('click', e => { e.stopPropagation(); appsMenu.classList.contains('open') ? closeMenu() : openMenu(); });
156
195
  homeBtn.addEventListener('click', e => { e.stopPropagation(); drawer.classList.contains('open') ? closeDrawer() : openDrawer(); });
157
196
  drawerClose.addEventListener('click', closeDrawer);
158
197
  drawer.addEventListener('click', e => { if (e.target === drawer) closeDrawer(); });
@@ -207,6 +246,9 @@ export function createDesktopShell({ root = document.body, wm, registry, brand =
207
246
  t.type = 'button';
208
247
  t.textContent = w.title;
209
248
  t.dataset.winId = w.id;
249
+ // aria-current announces which window is the active one; a
250
+ // sighted user reads this from the .focused visual state alone.
251
+ if (w.focused) t.setAttribute('aria-current', 'true');
210
252
  t.addEventListener('click', () => wm.focus(w.id));
211
253
  taskbar.appendChild(t);
212
254
  }