Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(item): only default slot content wraps #28773
Changes from 12 commits
c01f90c
4b2778e
509b262
e0918ad
c602b30
714d872
e64a3a7
bedd555
a6cd523
9ab0dd2
f77c288
e4f1142
ef4fa21
52520e5
4938caa
d9e034c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same "wiggling" that we saw in #28146 being undone.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is correct. The icons were in start/end slots which now no longer wrap to the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This diff is correct. The icons were in start/end slots which now no longer wrap to the next line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Range" is part of the default slot, and "End" is part of the end slot. Previously the "end" slot container would wrap to the next line. However, this was removed because it was incorrect. Now both the default and end slots will appear on the same line, and the default slot will shrink.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These screenshot changes are a result of c602b30. This screenshot tries to capture the text wrapping behavior found on native iOS when scaled up to 310%. However, as explained in the PR description, the label and note should really be in the same slot so they can wrap within the container.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would developers achieve this? We have notes documented as being slotted in items. The slotted notes with long labels are expanding outside of the viewport height at 310% with these changes:
vs. inside of the label at 100% they are not clinging to the sides:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have the same question; is there a way for developers (or us, for that matter) to detect the current font scale and adjust the markup dynamically?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is an area where we don't have a great solution right now. I'm not aware of how developers can easily have a long note go from the start slot to the default slot when the font size changes apart from putting the content in both slots and selectively hiding one based on the font size using
mod()
similar to what we do in datetime.However, I'd argue having both long notes and long labels in the same item isn't something we should encourage.
According to https://ionicframework.com/docs/api/item#metadata, any notes should be short/to the point such as a count or one/two words.
If developers follow that best practice, they'd get something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other idea is you could use a ResizeObserver on an element/container and then do something when that fires. I doubt that would be a very performant way of doing it though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the issue Brandy mentioned in #28773 (comment) is still present; some of the notes have their heights massively expanded with this change. Is that supposed to happen? 😆
Example: https://github.com/ionic-team/ionic-framework/pull/28773/files#diff-8911775ab4bd2c84af54bd46e1bf1a0d54ed17209271e5e0595de243fbf1240b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's why I suggested having the note in
ion-label
so they can wrap and why I mentioned that the test isn't a great example of best practices. The "Really really long note" text is in the start slot, and the default slot is collapsing to account for the width of the start slot. The text inside of theion-label
is wrapping to the next line, so you essentially have 1 character per line (but the width is so small so you don't see it).The orange/yellow is the
ion-label
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I see. In that case, should we update the test to avoid these long notes in the first place? Wouldn't be the first time we've adjusted tests to match best practices, and this one is particularly sticky since it leads to unnecessarily massive screenshots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated in d9e034c. Mind taking another look?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Muuuch better, thank you!!