Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(dashboard): name the composer banners' close buttons

Yudhi Armyndharisc29f266f0041
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 630048c28..4097be4c7 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -38,6 +38,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Draw group sender names in dashboard chat threads in colours that clear 4.5:1 on the incoming bubble in light and dark themes.
- Draw links inside a quoted dashboard chat message in the chat link colours, which clear 4.5:1 on the quote in light and dark themes.
- Draw the selection check in the dashboard New group list dark on its green fill, where white measured under 3:1.
+- Name the buttons that remove a staged file and close a reply above the dashboard chat composer for screen readers.
## [0.26.0] - 2026-10-28
diff --git a/dashboard/src/components/chats/ChatComposer.test.ts b/dashboard/src/components/chats/ChatComposer.test.ts
index ac39c8be4..20b7123f9 100644
--- a/dashboard/src/components/chats/ChatComposer.test.ts
+++ b/dashboard/src/components/chats/ChatComposer.test.ts
@@ -82,11 +82,11 @@ afterEach(() => {
after(() => rtl.cleanup());
-function Harness() {
+function Harness({ reply = null }: { reply?: ChatMessageView | null }) {
const [messageInput, setMessageInput] = useState('');
const [attachment, setAttachment] = useState<StagedAttachment | null>(null);
const [previewUrl, setPreviewUrl] = useState<string | null>(null);
- const [replyingTo, setReplyingTo] = useState<ChatMessageView | null>(null);
+ const [replyingTo, setReplyingTo] = useState<ChatMessageView | null>(reply);
return createElement(ChatComposer, {
selectedSessionId: 'sess-1',
activeChat: chat,
@@ -148,3 +148,27 @@ test('sending while a replacement pick is still being read sends neither file an
'the replacement pick was dropped',
);
});
+
+test('the attachment and reply banners name the buttons that close them', async () => {
+ const { screen, fireEvent, act } = rtl;
+ const reply = {
+ id: 'm1',
+ waMessageId: 'wamid.1',
+ chatId: chat.id,
+ body: 'see you at noon',
+ type: 'text',
+ direction: 'incoming',
+ status: 'read',
+ timestamp: 1_700_000_000,
+ createdAt: '2026-01-01T00:00:00.000Z',
+ } as ChatMessageView;
+ const { container } = rtl.render(wrap(createElement(Harness, { reply })));
+ const file = new window.File(['%PDF-1.4 stub'], 'contract.pdf', { type: 'application/pdf' });
+ fireEvent.change(container.querySelector('input[type="file"]')!, { target: { files: [file] } });
+ await act(async () => heldReads[0]());
+
+ fireEvent.click(screen.getByRole('button', { name: 'Remove file' }));
+ assert.equal(container.querySelector('.attachment-preview-banner') === null, true, 'the file stayed staged');
+ fireEvent.click(screen.getByRole('button', { name: 'Close' }));
+ assert.equal(container.querySelector('.replying-preview-banner') === null, true, 'the reply stayed open');
+});
diff --git a/dashboard/src/components/chats/ChatComposer.tsx b/dashboard/src/components/chats/ChatComposer.tsx
index ba9b50e04..d813051f5 100644
--- a/dashboard/src/components/chats/ChatComposer.tsx
+++ b/dashboard/src/components/chats/ChatComposer.tsx
@@ -317,7 +317,11 @@ function ChatComposer({
<span className="preview-filename">{attachment.filename}</span>
<span className="preview-filesize">({(attachment.file.size / 1024).toFixed(1)} KB)</span>
</div>
- <button className="btn-banner-close btn-remove-attachment" onClick={handleRemoveAttachment}>
+ <button
+ className="btn-banner-close btn-remove-attachment"
+ onClick={handleRemoveAttachment}
+ aria-label={t('messageTester.removeFile')}
+ >
<X size={18} />
</button>
</div>
@@ -351,7 +355,11 @@ function ChatComposer({
{replyingTo.type !== 'text' ? typeLabel(replyingTo.type) : replyingTo.body}
</div>
</div>
- <button className="btn-banner-close btn-close-reply" onClick={() => setReplyingTo(null)}>
+ <button
+ className="btn-banner-close btn-close-reply"
+ onClick={() => setReplyingTo(null)}
+ aria-label={t('common.close')}
+ >
<X size={18} />
</button>
</div>