Commit 7707b7d
authored
fix(a11y): add session timeout warning modal (WCAG 2.2.1) (#1557)
* feat(a11y): expose sessionTimeout in /dashboard/api/server-config
Reads spec.networking.auth.gateway.oAuthProxy.cookieExpireSeconds from
the CheCluster CR (che-operator PR #1760, +kubebuilder:default:=86400)
as the primary source. Falls back to parsing cookie_expire from the
che-gateway-config-oauth-proxy ConfigMap for clusters running older
operators where the CR field is absent. Returns -1 when neither source
is available so the frontend hook is a no-op.
- Add cookieExpireSeconds to CheClusterCustomResource networking type
(field name is oAuthProxy per Go JSON tag in che-operator PR #1760)
- Add parseDurationToSeconds helper (parses Go time.Duration strings;
returns -1 on empty/unmatched input so the hook disables itself)
- Add async getSessionTimeout(cheCustomResource) with CR-first + ConfigMap
fallback strategy
- Wire into the server-config route handler
- Add selectSessionTimeout Redux selector; default unloadedState to -1
Fixes: https://issues.redhat.com/browse/CRW-10290
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Oleksii Orel <oorel@redhat.com>
* feat(a11y): add useSessionTimeout hook for inactivity tracking
Tracks UI idle time via mousemove/keydown/click/touchstart events and
shows a warning modal 60 s before the OAuth session cookie expires.
Activity events are ignored while the modal is open so the countdown
is never accidentally reset by mouse movement.
- isModalOpenRef updated synchronously alongside React state to
eliminate the render/effect timing race (stale ref race)
- onExtend uses try/finally so the idle timer restarts on network failure
- No-op when sessionTimeout <= 0 (field absent on older operators)
Fixes: https://issues.redhat.com/browse/CRW-10290
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Oleksii Orel <oorel@redhat.com>
* feat(a11y): add SessionTimeoutModal and mount globally in App
PF6 small modal with amber countdown ring (red/pulsing at <= 20 s,
suppressed by prefers-reduced-motion), Extend Session and Sign Out Now
buttons. Mounted in App.tsx so it appears on every page.
- Icon uses var(--pf-t--global--icon--color--status--warning--default)
- Closing via X button or backdrop extends the session
- Space key listener active only while modal is open
Satisfies WCAG 2.2.1 Timing Adjustable (Level A).
Fixes: https://issues.redhat.com/browse/CRW-10290
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Oleksii Orel <oorel@redhat.com>
---------
Signed-off-by: Oleksii Orel <oorel@redhat.com>1 parent 7395441 commit 7707b7d
20 files changed
Lines changed: 925 additions & 1 deletion
File tree
- packages
- common/src/dto/api
- dashboard-backend/src
- devworkspaceClient
- services
- __tests__
- types
- routes/api
- __tests__
- helpers/__mocks__
- dashboard-frontend/src
- components
- SessionTimeoutModal
- __tests__
- __snapshots__
- WorkspaceProgress/StartingSteps/StartWorkspace/__tests__
- contexts/WorkspaceActions/__tests__
- services/session
- __tests__
- store/ServerConfig
- __tests__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
139 | 140 | | |
140 | 141 | | |
141 | 142 | | |
| |||
Lines changed: 70 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
26 | 30 | | |
27 | 31 | | |
28 | 32 | | |
| |||
344 | 348 | | |
345 | 349 | | |
346 | 350 | | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
347 | 416 | | |
348 | 417 | | |
349 | 418 | | |
| |||
Lines changed: 59 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
37 | 62 | | |
38 | 63 | | |
39 | 64 | | |
40 | 65 | | |
41 | 66 | | |
42 | 67 | | |
| 68 | + | |
43 | 69 | | |
44 | 70 | | |
45 | 71 | | |
46 | 72 | | |
| 73 | + | |
47 | 74 | | |
48 | 75 | | |
49 | 76 | | |
| |||
311 | 338 | | |
312 | 339 | | |
313 | 340 | | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
314 | 373 | | |
315 | 374 | | |
316 | 375 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
| |||
413 | 419 | | |
414 | 420 | | |
415 | 421 | | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
416 | 431 | | |
417 | 432 | | |
418 | 433 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
| |||
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
| 210 | + | |
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
| 55 | + | |
55 | 56 | | |
56 | 57 | | |
57 | 58 | | |
| |||
67 | 68 | | |
68 | 69 | | |
69 | 70 | | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
0 commit comments