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(item): only default slot content wraps #28773

Merged
merged 16 commits into from
Jan 26, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
72 changes: 2 additions & 70 deletions core/src/components/item/item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,6 @@
* @prop --highlight-color-valid: The color of the highlight on the item when valid. Only applies to inputs and textareas using the legacy form syntax. DEPRECATED: Highlights can be styled on `ion-input` or `ion-textarea` when using the modern form syntax.
* @prop --highlight-color-invalid: The color of the highlight on the item when invalid. Only applies to inputs and textareas using the legacy form syntax. DEPRECATED: Highlights can be styled on `ion-input` or `ion-textarea` when using the modern form syntax.
*/

/**
* We change the minimum width as the
* font size changes. Using a fixed minimum
* width means that fewer and fewer characters
* can be displayed in the same space as the
* text grows.
*/
--inner-min-width: 4rem;
Copy link
Contributor Author

@liamdebeasi liamdebeasi Jan 10, 2024

Choose a reason for hiding this comment

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

This API was only needed to control when the default slot content should stop wrapping within its container and instead have the container wrap to the next line. Since the container no longer wraps to the next line, this API was removed.

Note that this is a private API so it is not a breaking change.

--border-radius: 0px;
--border-width: 0px;
--border-style: solid;
Expand Down Expand Up @@ -230,11 +221,6 @@
display: flex;
position: relative;

// Flex wrap is required here in order to wrap
// the start slot + .item-inner content that
// doesn't fit on the same line
flex-wrap: wrap;

align-items: inherit;
justify-content: inherit;

Expand All @@ -258,11 +244,6 @@
box-sizing: border-box;
}

// TODO(FW-5289): remove
:host(.item-legacy) .item-native {
flex-wrap: unset;
}

.item-native::-moz-focus-inner {
border: 0;
}
Expand Down Expand Up @@ -307,34 +288,13 @@ button, a {
// This is required to work with an inset highlight
position: relative;

// This flex property is required in order to make
// the elements wrap when there is a slotted start
// element and a label
flex: 1 0 0;
flex: 1;

flex-direction: inherit;

// Flex wrap is required here in order to wrap
// .input-wrapper content + the end slot that
// doesn't fit on the same line
flex-wrap: wrap;

align-items: inherit;
align-self: stretch;

/**
* The min-width defines when the
* content in the default slot should
* stop wrapping/truncating within its own
* container. At this point the entire
* container will wrap to the next line.
*/
min-width: var(--inner-min-width);

// Max width must be set to 100%, otherwise the
// elements will overflow this container instead
// of wrapping
max-width: 100%;
min-height: inherit;

border-width: var(--inner-border-width);
Expand All @@ -346,15 +306,6 @@ button, a {
box-sizing: border-box;
}

// TODO(FW-5289): remove
:host(.item-legacy) .item-inner {
flex: 1;

flex-wrap: unset;

max-width: unset;
}

// Item Bottom
// --------------------------------------------------

Expand Down Expand Up @@ -448,38 +399,19 @@ button, a {
// This flex property is required in order to keep
// the label from shrinking when there are wide
// elements next to it
flex: 1 0 auto;
flex: 1;

flex-direction: inherit;

// Flex wrap is required here in order to wrap
// content in the default slot (such as a label
// and a button) that doesn't fit on the same line
flex-wrap: wrap;

align-items: inherit;
align-self: stretch;

// Max width must be set to 100%, otherwise the
// elements will overflow this container instead
// of wrapping
max-width: 100%;

text-overflow: ellipsis;

overflow: inherit;
box-sizing: border-box;
}

// TODO(FW-5289): remove
:host(.item-legacy) .input-wrapper {
flex: 1;

flex-wrap: unset;

max-width: unset;
}

:host(.item-label-stacked),
:host(.item-label-floating) {
align-items: start;
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions core/src/components/note/test/a11y/note.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,33 +72,33 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {

<ion-list>
<ion-item>
<ion-note slot="start">Really really long note</ion-note>
<ion-note slot="start">123</ion-note>
<ion-label>Label</ion-label>
</ion-item>

<ion-item>
<ion-label>Label</ion-label>
<ion-note slot="end">Really really long note</ion-note>
<ion-note slot="end">123</ion-note>
</ion-item>

<ion-item>
<ion-note slot="start">Note</ion-note>
<ion-note slot="start">123</ion-note>
<ion-label>Really really long label</ion-label>
</ion-item>

<ion-item>
<ion-label>Really really long label</ion-label>
<ion-note slot="end">Note</ion-note>
<ion-note slot="end">123</ion-note>
</ion-item>

<ion-item>
<ion-note slot="start">Really really long note</ion-note>
<ion-note slot="start">123</ion-note>
<ion-label>Really really long label</ion-label>
</ion-item>

<ion-item>
<ion-label>Really really long label</ion-label>
<ion-note slot="end">Really really long note</ion-note>
<ion-note slot="end">123</ion-note>
</ion-item>
</ion-list>
`,
Expand Down
Loading