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

fix(action): maintain equal height when text is not enabled in a small scale #9051

Merged
merged 2 commits into from
Apr 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
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 @@ -210,6 +210,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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏆

<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})` : ""}`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use a localized template. Since this is already in production, can you create an issue? We can link to action’s doc site page for the repro case since this is a screen reader label.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

created #9071

: "";

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
Loading