fix(collab): the expand button on a note showed its own translation key

`collab.notes.expand` was never added to the catalogue, and `t()` answers with
the key itself, so the `|| 'Expand'` fallback never ran and the tooltip read
collab.notes.expand. `common.expand` says the same thing and is already
translated everywhere, so the button uses that, and it now carries the label
for assistive tech as well.
This commit is contained in:
Maurice
2026-09-21 22:30:24 +00:00
parent 1e9b23c5dd
commit 1f01447093
2 changed files with 14 additions and 15 deletions
@@ -498,8 +498,7 @@ describe('CollabNotes', () => {
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Expandable Note');
// Expand button (Maximize2 icon) appears when note has content
// The translation key 'collab.notes.expand' falls back to the raw key since it's not in en.ts
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
// View modal shows the note title
await waitFor(() => {
const titles = screen.getAllByText('Expandable Note');
@@ -522,7 +521,7 @@ describe('CollabNotes', () => {
);
render(<CollabNotes {...defaultProps} />);
await screen.findByText('View Modal Note');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
// Modal is open — there are multiple instances of the title
await waitFor(() => expect(screen.getAllByText('View Modal Note').length).toBeGreaterThan(1));
// The view modal renders a pencil button to switch to edit mode
@@ -927,7 +926,7 @@ describe('CollabNotes', () => {
);
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Full Content Note');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
// View modal shows the full content
await waitFor(() => {
const titles = screen.getAllByText('Full Content Note');
@@ -952,7 +951,7 @@ describe('CollabNotes', () => {
);
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Tagged Note');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
// View modal header shows the category name
await waitFor(() => {
const foodEls = screen.getAllByText('Food');
@@ -1108,7 +1107,7 @@ describe('CollabNotes', () => {
await screen.findByText('Attached View Note');
// PDF badge is present in NoteCard
expect(screen.getByText('PDF')).toBeInTheDocument();
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
// View modal opens — title appears multiple times
await waitFor(() => expect(screen.getAllByText('Attached View Note').length).toBeGreaterThan(1));
// PDF badge appears in both card and view modal
@@ -1132,7 +1131,7 @@ describe('CollabNotes', () => {
);
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Image View Note');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
// View modal opens
await waitFor(() => expect(screen.getAllByText('Image View Note').length).toBeGreaterThan(1));
// The view modal code for image attachments executed (AuthedImg renders initially null, then img after async)
@@ -1154,7 +1153,7 @@ describe('CollabNotes', () => {
);
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Transition Note');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
await waitFor(() => expect(screen.getAllByText('Transition Note').length).toBeGreaterThan(1));
// Click the Pencil button in the view modal (second-to-last button)
const allButtons = screen.getAllByRole('button');
@@ -1713,7 +1712,7 @@ describe('CollabNotes details', () => {
serveNotes({ notes: [buildNote({ id: 5, title: 'Long note', content: 'Full body', category: 'Food', color: '#ef4444' })] });
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Long note');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
const modal = await waitFor(() => {
const md = document.querySelector('.collab-note-md-full')
if (!md) throw new Error('view modal not open yet')
@@ -1751,7 +1750,7 @@ describe('CollabNotes details', () => {
});
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Trip docs');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
const modal = await waitFor(() => {
const md = document.querySelector('.collab-note-md-full')
if (!md) throw new Error('view modal not open yet')
@@ -1928,7 +1927,7 @@ describe('CollabNotes details', () => {
serveNotes({ notes: [buildNote({ id: 7, title: 'Hotel', content: 'Zimmernummer <TBD> bestaetigen' })] });
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Hotel');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
const full = await openedNoteBody();
// Notes written before markdown rendering existed keep reading the way they
// were typed (#2177).
@@ -1940,7 +1939,7 @@ describe('CollabNotes details', () => {
serveNotes({ notes: [buildNote({ id: 8, title: 'Booking', content: 'Hotel gebucht[^1]\n\n[^1]: Bestaetigung ABC123' })] });
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Booking');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
const full = await openedNoteBody();
const ref = within(full).getByRole('link', { name: '1' });
@@ -1956,7 +1955,7 @@ describe('CollabNotes details', () => {
server.use(http.get('/api/trips/1/collab/link-preview', () => HttpResponse.json({ title: 'Hotel', image: null })));
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Hotel');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
const full = await openedNoteBody();
// A member without collab_edit never opens the edit modal, so this is the
@@ -1972,7 +1971,7 @@ describe('CollabNotes details', () => {
serveNotes({ notes: [buildNote({ id: 10, title: 'Hotel', website: 'javascript:alert(1)' })] });
render(<CollabNotes {...defaultProps} />);
await screen.findByText('Hotel');
await user.click(screen.getByTitle('collab.notes.expand'));
await user.click(screen.getByRole('button', { name: 'Expand' }));
const full = await openedNoteBody();
expect(within(full).queryAllByRole('link')).toHaveLength(0);
@@ -81,7 +81,7 @@ export function NoteCard({ note, currentUser, canEdit, onUpdate, onDelete, onEdi
display: 'flex', gap: 2,
}}>
{note.content && (
<button type="button" onClick={() => onView?.(note)} title={t('collab.notes.expand') || 'Expand'}
<button type="button" onClick={() => onView?.(note)} title={t('common.expand')} aria-label={t('common.expand')}
style={{ padding: 3, background: 'none', border: 'none', cursor: 'pointer', color: 'var(--text-faint)', display: 'flex' }}
onMouseEnter={e => e.currentTarget.style.color = 'var(--text-primary)'}
onMouseLeave={e => e.currentTarget.style.color = 'var(--text-faint)'}>