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(toggle): expose label wrapper as shadow part #28585

Merged
merged 9 commits into from
Nov 30, 2023
Merged

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Nov 27, 2023

Issue number: Part of #28300


What is the current behavior?

Developers can access the contents of the label in ion-toggle. However, they do not access the label wrapper. As a result, they are unable to customize the position of the label wrapper relative to the control (margin, padding, etc).

What is the new behavior?

  • Adds a label shadow part to ion-toggle

Does this introduce a breaking change?

  • Yes
  • No

Other information

As part of this work, I investigated the pointer-events on .label-text-wrapper to see if we need to move it higher up in the DOM:

This code was originally added for ion-input: 9a9568c. I later added this same logic when updating toggle #26357. However, I was not able to reproduce the original issue with ion-toggle (tested iOS 16, iOS 17, Android 13 with screen readers on). This leads me to believe that the patch is only needed for text input controls.

I removed the code from ion-toggle. However, authors should still verify if this code is needed for each of the remaining features (checkbox, radio, and range).

@github-actions github-actions bot added the package: core @ionic/core package label Nov 27, 2023
@liamdebeasi liamdebeasi changed the title Fw 5615 feat(toggle): expose label element as shadow part Nov 27, 2023
@liamdebeasi liamdebeasi changed the title feat(toggle): expose label element as shadow part feat(toggle): expose label wrapper as shadow part Nov 27, 2023
@github-actions github-actions bot added the package: vue @ionic/vue package label Nov 27, 2023
Comment on lines 52 to 53
expect(toggle.shadowRoot!.querySelector('[part="track"]')).not.toBe(null);
expect(toggle.shadowRoot!.querySelector('[part="handle"]')).not.toBe(null);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not strictly necessary for this PR, but I figured while I was here I might as well check the other shadow parts too.

@github-actions github-actions bot removed the package: vue @ionic/vue package label Nov 29, 2023
@liamdebeasi liamdebeasi marked this pull request as ready for review November 29, 2023 18:11
@liamdebeasi liamdebeasi requested a review from a team as a code owner November 29, 2023 18:11
@liamdebeasi liamdebeasi requested review from brandyscarney and mapsandapps and removed request for a team November 29, 2023 18:11
Copy link
Contributor

@mapsandapps mapsandapps left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏻

@liamdebeasi liamdebeasi merged commit a34188f into feature-7.6 Nov 30, 2023
44 checks passed
@liamdebeasi liamdebeasi deleted the FW-5615 branch November 30, 2023 19:03
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.

3 participants