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(checkbox): align checkbox properly in item using start alignment #29850

Merged
merged 10 commits into from
Sep 10, 2024

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.

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
Member

@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
48 checks passed
@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
3 participants