Skip to content

Commit 897a777

Browse files
authored
fix(dropdown)!: change display to inline-block to ease truncation setup (#8253)
**Related Issue:** #5903 ## Summary BREAKING CHANGE: Dropdown's default `display` was changed from `inline-flex` to `inline-block` to make it easier to prompt truncation in trigger button text with minimal impact to layout (by setting an explicit width **or** setting `width: 100%` or `display: block` on the dropdown of a width-constrained parent).
1 parent bf90796 commit 897a777

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

packages/calcite-components/src/components/dropdown/dropdown.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe("calcite-dropdown", () => {
5858
});
5959

6060
describe("renders", () => {
61-
renders(simpleDropdownHTML, { display: "inline-flex" });
61+
renders(simpleDropdownHTML, { display: "inline-block" });
6262
});
6363

6464
describe("honors hidden attribute", () => {

packages/calcite-components/src/components/dropdown/dropdown.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
:host {
10-
@apply inline-flex flex-initial;
10+
@apply inline-block flex-initial;
1111
}
1212

1313
@include disabled();

packages/calcite-components/src/components/dropdown/dropdown.stories.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,3 +462,21 @@ export const triggerWordBreak_TestOnly = (): string => html`<div style="width:30
462462
</calcite-dropdown-group>
463463
</calcite-dropdown>
464464
</div>`;
465+
466+
export const settingFullWidthEnablesTriggerTruncation_TestOnly = (): string => html`<div
467+
style="width: 300px; border: solid"
468+
>
469+
<calcite-dropdown style="width: 100%;">
470+
<calcite-button width="full" slot="trigger"
471+
>This is some really long text that will eventually overrun the container</calcite-button
472+
>
473+
<calcite-dropdown-group group-title="Natural places">
474+
<calcite-dropdown-item>Mountain</calcite-dropdown-item>
475+
<calcite-dropdown-item>River</calcite-dropdown-item>
476+
<calcite-dropdown-item>Waterfall</calcite-dropdown-item>
477+
<calcite-dropdown-item>Rainforest</calcite-dropdown-item>
478+
<calcite-dropdown-item>Tundra</calcite-dropdown-item>
479+
<calcite-dropdown-item>Desert</calcite-dropdown-item>
480+
</calcite-dropdown-group>
481+
</calcite-dropdown>
482+
</div>`;

0 commit comments

Comments
 (0)