Commit 27e24a7
authored
fix(chat): a11y + UX polish caught by live browser smoke (0.0.25) (#198)
* fix(chat): a11y + UX polish caught by live browser smoke (0.0.25)
Three fixes from continued live Chrome smoke testing of @ngaf/chat 0.0.24:
1. **Textarea auto-resize**: rows="1" with no auto-grow logic meant
multi-line input via Shift+Enter was hidden behind the fixed 24px
height (scrollHeight grew to 72px+ while clientHeight stayed at 24px).
Added an effect() that resizes el.style.height to scrollHeight on
every messageText change, capped at 200px (~8 lines) before
switching to overflow scrolling.
2. **Escape closes model picker from trigger**: ChatSelectComponent
handled Escape only on keydown inside the menu (focused option).
When user clicked the trigger to open and pressed Escape without
arrowing into the menu, the keypress hit the trigger which only
handled Enter/Space/ArrowDown — Escape was ignored and the menu
stayed open until click-outside. Added Escape branch to
onTriggerKeydown.
3. **aria-pressed on rating toggle buttons**: thumbs-up/down rendered
visual is-active class but no aria-pressed attribute. Screen
readers couldn't communicate toggle state. Added [attr.aria-pressed]
bound to the rating signal.
Synchronized version bump to 0.0.25 across all 16 @Ngaf libs.
* fix(chat): pass [message] to assistant <chat-message> for citations panel
Live Chrome smoke against published 0.0.24 caught: chat-citations is
template-conditioned on @if (message()?.role === 'assistant' && message()),
but the chat composition did not pass [message]="message" to
<chat-message>. So message() was always undefined inside chat-message,
the @if branch was falsy, and <chat-citations> never rendered — even when
markdown citation defs existed in the message content.
This was the missing piece of the 0.0.24 sources panel fix. Three of the
four fixes worked end-to-end (table rows, citation no-url span, task-list
checkbox layout); the panel itself silently never appeared.
Fix: add [message]="message" to the assistant <chat-message> in
chat.component.ts. The user/system variants don't need it.
* fix(chat): clipboard fallback on writeText rejection
Live Chrome smoke caught: when navigator.clipboard.writeText rejects
(permissions, non-secure context, document-not-focused), the catch
silently swallowed the error. The textarea+execCommand legacy path was
only used when clipboard API was missing — not when it failed.
Refactored: try Async Clipboard API first; on rejection, fall through
to the textarea legacy path. Only set copied state when at least one
path succeeded.
* fix(chat): wide-table overflow scroll + broken-image alt fallback
Live Chrome smoke caught:
1. Wide tables (8+ columns or long content) had no overflow handling.
chat-md-table used 'display: contents' so the inner <table> dictated
width, with parent at viewport width — wider tables overflowed
horizontally with no scroll wrapper. Fixed: chat-md-table now uses
'display: block; overflow-x: auto; max-width: 100%' so wide tables
scroll within their message bubble. Row/cell elements stay
layout-transparent so browser table layout still works.
2. Broken images (404 / invalid URL) showed only the browser's default
broken-image icon with no readable alt text. Fixed: <img> now binds
(error) to a 'failed' signal that swaps to a styled fallback pill
showing the alt text and a placeholder icon. Pill uses the same
surface-alt background as code blocks for consistency.1 parent 11cdf33 commit 27e24a7
24 files changed
Lines changed: 154 additions & 27 deletions
File tree
- libs
- a2ui
- ag-ui
- chat
- src/lib
- compositions/chat
- markdown/views
- primitives
- chat-input
- chat-message-actions
- chat-select
- styles
- cockpit-docs
- cockpit-registry
- cockpit-shell
- cockpit-testing
- cockpit-ui
- db
- design-tokens
- example-layouts
- langgraph
- licensing
- partial-json
- render
- ui-react
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
11 | 32 | | |
12 | 33 | | |
13 | 34 | | |
| 35 | + | |
14 | 36 | | |
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
124 | 138 | | |
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
119 | 144 | | |
120 | 145 | | |
121 | 146 | | |
| |||
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| |||
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
102 | | - | |
103 | | - | |
104 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
105 | 112 | | |
106 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
107 | 120 | | |
108 | 121 | | |
109 | 122 | | |
110 | 123 | | |
111 | 124 | | |
112 | 125 | | |
113 | | - | |
| 126 | + | |
114 | 127 | | |
| 128 | + | |
| 129 | + | |
115 | 130 | | |
| 131 | + | |
| 132 | + | |
116 | 133 | | |
117 | 134 | | |
118 | 135 | | |
119 | | - | |
120 | | - | |
121 | 136 | | |
122 | 137 | | |
123 | 138 | | |
| |||
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
100 | 115 | | |
101 | 116 | | |
102 | 117 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
142 | 151 | | |
143 | 152 | | |
144 | 153 | | |
| |||
0 commit comments