SIGN IN SIGN UP

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

0 0 0 TypeScript

fix(checkbox): show labels after page navigation (#31062)

Issue number: resolves #31052

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
After a page navigation, ion-checkbox's `onslotchange` event fires
before the element's `textContent` has been updated. It is called again
after `textContent` becomes readable on Safari, but is not called again
after the `textContent` becomes readable on Chrome and Firefox.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Uses `MutationObserver` instead of `onslotchange` and fires
specifically on character data changes. This ensures `hasLabelContent`
is up to date.
- `MutationObserver` does not fire on load, so `hasLabelContent` is
initialized in `connectedCallback`

## Does this introduce a breaking change?

- [ ] Yes
- [X] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->
O
OS-jacobbell committed
f4ac4459f8317bd5eeff7d4809f9cb0991c8efd9
Parent: 308aef5
Committed by GitHub <noreply@github.com> on 4/14/2026, 1:27:28 PM