Skip to content

Commit

Permalink
fix(action): maintain equal height when text is not enabled in a smal…
Browse files Browse the repository at this point in the history
…l scale (#9051)

**Related Issue:** #8900

## Summary

- Maintain equal height when text is not enabled in a small scale
- Add screenshot test
  • Loading branch information
driskull committed Apr 9, 2024
1 parent 5d13ec5 commit 407824a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
items-center
justify-center;
min-inline-size: theme("spacing.4");
min-block-size: theme("spacing.4");
min-block-size: theme("spacing.6");
}

.text-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,20 @@ export const indicatorNoTextEnabledNoIcon_TestOnly = (): string => html`
<calcite-action indicator active text="click-me"></calcite-action>
`;

export const noTextHeight_TestOnly = (): string =>
html`<h2>All actions should be the same height</h2>
<div style="width: min-content">
<div style="border: solid 1px">
<calcite-action text="hello" text-enabled icon="home" scale="s"></calcite-action>
</div>
<div style="border: solid 1px">
<calcite-action text="hello" icon="home" scale="s"></calcite-action>
</div>
<div style="border: solid 1px">
<calcite-action icon="home" scale="s"></calcite-action>
</div>
</div>`;

export const arabicLocale_TestOnly = (): string => html`
<calcite-action
dir="rtl"
Expand Down
5 changes: 4 additions & 1 deletion packages/calcite-components/src/components/action/action.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,10 @@ export class Action
buttonId,
messages,
} = this;
const ariaLabel = `${label || text}${indicator ? ` (${messages.indicator})` : ""}`;
const labelFallback = label || text;
const ariaLabel = labelFallback
? `${labelFallback}${indicator ? ` (${messages.indicator})` : ""}`
: "";

const buttonClasses = {
[CSS.button]: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ describe("calcite-navigation", () => {

describe("accessible", () => {
accessible(
html`<calcite-navigation navigation-action><calcite-navigation-logo heading="Test" /></calcite-navigation>`,
html`<calcite-navigation label="test" navigation-action
><calcite-navigation-logo heading="Test"
/></calcite-navigation>`,
);
});

Expand Down

0 comments on commit 407824a

Please sign in to comment.