Skip to content

Commit

Permalink
Fix tabs being detached from tab panel on touch devices
Browse files Browse the repository at this point in the history
The `CloseButton` component in @hypothesis/frontend-shared has styling that
makes it taller (44px) on touch devices, but the `Tab` component does not. Items
in the `TabHeader` are centered on the cross axis, so on mobile, the close
button became taller than the tabs and detached them from the tab panel.

An alternative way to fix this would be to make tabs also grow in height on
touch devices, but they are quite usable without.

Fixes #6131
  • Loading branch information
robertknight committed Jan 26, 2024
1 parent 35b84a4 commit 4fd83ba
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sidebar/components/tabs/TabHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ export default function TabHeader({
// font size
'text-[16px]',
'text-grey-6 hover:text-grey-7 hover:bg-grey-3/50',

// Keep the close button the same height on touch devices.
//
// This is needed so that the close button remains the same height as
// the `Tab` components rendered inside the `TabList`. See issue #6131.
'touch:!min-h-0',
)}
title="Close"
variant="custom"
Expand Down

0 comments on commit 4fd83ba

Please sign in to comment.