Skip to content

Conversation

@brandyscarney
Copy link
Member

@brandyscarney brandyscarney commented Sep 9, 2024

Issue number: resolves #29837


What is the current behavior?

The checkbox is not aligned properly to the top when using a long label with alignment="start" inside of an ion-item:

<ion-item>
  <ion-checkbox justify="start" alignment="start">
    <ion-label class="ion-text-wrap">
      Enable Notifications Enable Notifications Enable Notifications
    </ion-label>
  </ion-checkbox>
</ion-item>

What is the new behavior?

  • Applies the same margin to the .native-wrapper (checkbox) as the label.
  • Adds a screenshot test to verify the alignment

Does this introduce a breaking change?

  • Yes
  • No

Other information

Before After
before after
before after

Note

The alignment on the Material Design checkbox is still slightly off. I could add margin directly to its checkbox but then it would change the margin of the checkbox in all use cases.

@vercel
Copy link

vercel bot commented Sep 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ionic-framework ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 9, 2024 8:01pm

@github-actions github-actions bot added the package: core @ionic/core package label Sep 9, 2024
// Checkboxes that are not slotted inside an item and are not used with a
// stacked label should have margins equal to those of the label.
:host(.in-item) .label-text-wrapper,
:host(.in-item:not(.checkbox-label-placement-stacked):not([slot])) .native-wrapper {
Copy link
Member Author

Choose a reason for hiding this comment

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

Slotted checkboxes are excluded because the following would otherwise result in increased item height:

<ion-item>
  <ion-checkbox slot="start">Start</ion-checkbox>
  Checkbox
</ion-item>

Copy link
Contributor

@tanner-reits tanner-reits left a comment

Choose a reason for hiding this comment

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

LGTM

@brandyscarney brandyscarney added this pull request to the merge queue Sep 10, 2024
Merged via the queue into main with commit 88b7013 Sep 10, 2024
@brandyscarney brandyscarney deleted the ROU-11163 branch September 10, 2024 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Unable to vertically align ion-checkbox using the old or new label syntax when using ion-text-wrap and label text spans multiple lines.

4 participants