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

feat(checkbox): display as block when justify or alignment properties are defined #29783

Merged
merged 22 commits into from
Aug 28, 2024

Conversation

brandyscarney
Copy link
Member

@brandyscarney brandyscarney commented Aug 20, 2024

Issue number: internal


What is the current behavior?

When adding the justify or alignment property to an ion-checkbox it does not change the design because the checkbox is displayed inline.

What is the new behavior?

  • Change the checkbox's display property to block when the justify or alignment property is set.
  • Set the default justify-content style to space-between so that a checkbox with width: 100% set without justify or alignment set will still have the same default
  • Modifies the label e2e test to remove the explicit width as setting the property will make them full-width
  • Adds two examples to the label e2e test of labels that do not have justify set but use width: 100% to ensure they are working as expected without it

Does this introduce a breaking change?

  • Yes
  • No

Other information

Copy link

vercel bot commented Aug 20, 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 Aug 26, 2024 8:05pm

@@ -36,7 +36,7 @@ configs({ directions: ['ltr'] }).forEach(({ title, config, screenshot }) => {
font-size: 310%;
}
</style>
<ion-checkbox justify="start" checked>Checked</ion-checkbox>
Copy link
Member Author

Choose a reason for hiding this comment

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

The justify property does not need to be on this test as all it does is force the Checkbox to be 100% width when it isn't necessary.

@@ -72,7 +72,9 @@
flex-grow: 1;

align-items: center;
justify-content: space-between;
Copy link
Member Author

Choose a reason for hiding this comment

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

This is required so that the user can still do the following, with a space between the label and checkbox:

<ion-checkbox style="width: 100%">Label</ion-checkbox>

*/
configs().forEach(({ title, screenshot, config }) => {
test.describe(title('checkbox: label'), () => {
test.describe('checkbox: start placement', () => {
test('should render a start justification with label in the start position', async ({ page }) => {
await page.setContent(
`
<ion-checkbox label-placement="start" justify="start" style="width: 200px">Label</ion-checkbox>
Copy link
Member Author

@brandyscarney brandyscarney Aug 22, 2024

Choose a reason for hiding this comment

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

An explicit width is no longer needed since using justify sets display: block which takes up the full-width of its container.

Long Label Long Label Long Label Long Label Long Label Long Label
</ion-checkbox>
`,
config
);

const checkbox = page.locator('ion-checkbox');
await expect(checkbox).toHaveScreenshot(screenshot(`checkbox-long-label`));
await expect(checkbox).toHaveScreenshot(screenshot(`checkbox-label-start-justify-start-long-label`));
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed this test to match the other prefixes in this describe block.

Copy link
Member Author

Choose a reason for hiding this comment

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

These width differences are expected since removing the explicit width: 200px makes the checkbox take up the full width with justify defined.

Copy link
Member Author

Choose a reason for hiding this comment

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

These width differences are expected since removing the explicit width: 200px makes the checkbox take up the inline width without justify defined.

Copy link
Member Author

Choose a reason for hiding this comment

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

This was renamed to checkbox-label-start-justify-start-long-label

@brandyscarney brandyscarney changed the title feat(checkbox): display as flex when justify property is defined feat(checkbox): display as block when justify or alignment properties are defined Aug 23, 2024
Copy link
Contributor

@thetaPC thetaPC 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 merged commit 4ccd15e into feature-8.3 Aug 28, 2024
46 checks passed
@brandyscarney brandyscarney deleted the ROU-10906 branch August 28, 2024 19:06
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.

4 participants