-
Notifications
You must be signed in to change notification settings - Fork 13.5k
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
liamdebeasi
changed the title
Fw 5615
feat(toggle): expose label element as shadow part
Nov 27, 2023
liamdebeasi
changed the title
feat(toggle): expose label element as shadow part
feat(toggle): expose label wrapper as shadow part
Nov 27, 2023
liamdebeasi
commented
Nov 28, 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); |
There was a problem hiding this comment.
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.
liamdebeasi
requested review from
brandyscarney and
mapsandapps
and removed request for
a team
November 29, 2023 18:11
2 tasks
mapsandapps
approved these changes
Nov 29, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍🏻
brandyscarney
approved these changes
Nov 30, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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?
label
shadow part toion-toggle
Does this introduce a breaking change?
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:ionic-framework/core/src/components/toggle/toggle.scss
Line 113 in 01130e1
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 withion-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).