Skip to content

feat(toggle): expose label wrapper as shadow part - #28585

Merged
liamdebeasi merged 9 commits into
feature-7.6from
FW-5615
Nov 30, 2023
Merged

feat(toggle): expose label wrapper as shadow part#28585
liamdebeasi merged 9 commits into
feature-7.6from
FW-5615

Conversation

@liamdebeasi

@liamdebeasi liamdebeasi commented Nov 27, 2023

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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

@mapsandapps mapsandapps left a comment

Copy link
Copy Markdown
Contributor

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
@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