Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Tabs have a fluid height #62027

Merged
merged 2 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

### Bug Fixes

- `Tabs`: Make Tabs have a fluid height ([#62027](https://github.com/WordPress/gutenberg/pull/62027)).
- `UnitControl`: Fix colors when disabled. ([#62970](https://github.com/WordPress/gutenberg/pull/62970))
- `useUpdateEffect`: Correctly track mounted state in strict mode. ([#62974](https://github.com/WordPress/gutenberg/pull/62974))
- `UnitControl`: Fix an issue where keyboard shortcuts unintentionally shift focus on Windows OS. ([#62988](https://github.com/WordPress/gutenberg/pull/62988))
Expand Down
14 changes: 8 additions & 6 deletions packages/components/src/tabs/styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,16 @@ export const Tab = styled( Ariakit.Tab )`
align-items: center;
position: relative;
border-radius: 0;
height: ${ space( 12 ) };
min-height: ${ space(
12
) }; // Avoid fixed height to allow for long strings that go in multiple lines.
height: auto;
background: transparent;
border: none;
box-shadow: none;
cursor: pointer;
padding: 3px ${ space( 4 ) }; // Use padding to offset the [aria-selected="true"] border, this benefits Windows High Contrast mode
line-height: 1.2; // Some languages characters e.g. Japanese may have a native higher line-height.
padding: ${ space( 4 ) };
margin-left: 0;
font-weight: 500;

Expand Down Expand Up @@ -93,7 +97,8 @@ export const Tab = styled( Ariakit.Tab )`
pointer-events: none;

// Draw the indicator.
box-shadow: 0 0 0 var( --wp-admin-border-width-focus )
// Outline works for Windows high contrast mode as well.
outline: var( --wp-admin-border-width-focus ) solid
${ COLORS.theme.accent };
border-radius: 2px;

Expand All @@ -107,9 +112,6 @@ export const Tab = styled( Ariakit.Tab )`

&:focus-visible::before {
opacity: 1;

// Windows high contrast mode.
outline: 2px solid transparent;
}
}
`;
Expand Down
Loading