mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 00:12:39 +00:00
fix: show a contact's copy and compose buttons on keyboard focus and touch
This commit is contained in:
@@ -45,6 +45,14 @@ describe('ContactDetail', () => {
|
||||
expect(link.closest('a')).toHaveAttribute('href', 'mailto:alice@example.com');
|
||||
});
|
||||
|
||||
it('shows the copy and compose buttons on keyboard focus and touch, not only on hover', () => {
|
||||
render(<ContactDetail contact={contact} onEdit={vi.fn()} onDelete={vi.fn()} />);
|
||||
const copy = screen.getByRole('button', { name: 'detail.copy_email' });
|
||||
const actions = copy.closest('[data-row-actions]') as HTMLElement;
|
||||
expect(actions.className).toContain('group-focus-within:opacity-100');
|
||||
expect(actions.className).toContain('pointer-coarse:opacity-100');
|
||||
});
|
||||
|
||||
it('displays phone numbers', () => {
|
||||
render(<ContactDetail contact={contact} onEdit={vi.fn()} onDelete={vi.fn()} />);
|
||||
expect(screen.getByText('+33612345678')).toBeInTheDocument();
|
||||
|
||||
@@ -517,8 +517,10 @@ function FieldRow({ icon: Icon, label, children }: { icon: React.ComponentType<{
|
||||
}
|
||||
|
||||
function RowActions({ children }: { children: React.ReactNode }) {
|
||||
// Shown on hover, while the keyboard is in the row and always on touch
|
||||
// screens, which have no hover (WCAG 2.1.1, 2.4.7).
|
||||
return (
|
||||
<div className="flex items-center gap-0.5 opacity-0 group-hover:opacity-100 transition-opacity">
|
||||
<div data-row-actions className="flex items-center gap-0.5 opacity-0 group-hover:opacity-100 group-focus-within:opacity-100 pointer-coarse:opacity-100 transition-opacity">
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user