feat(range): expose label wrapper as shadow part - #28601
Merged
Merged
Conversation
liamdebeasi
commented
Nov 29, 2023
Comment on lines
+241
to
+246
| expect(range.shadowRoot!.querySelector('[part="pin"]')).not.toBe(null); | ||
| expect(range.shadowRoot!.querySelector('[part="knob"]')).not.toBe(null); | ||
| expect(range.shadowRoot!.querySelector('[part="bar"]')).not.toBe(null); | ||
| expect(range.shadowRoot!.querySelector('[part="bar-active"]')).not.toBe(null); | ||
| expect(range.shadowRoot!.querySelector('[part="tick"]')).not.toBe(null); | ||
| expect(range.shadowRoot!.querySelector('[part="tick-active"]')).not.toBe(null); |
Contributor
Author
There was a problem hiding this comment.
Not strictly necessary for this PR, but I figured while I was here I might as well check the other shadow parts too.
liamdebeasi
marked this pull request as ready for review
November 29, 2023 19:54
liamdebeasi
requested review from
mapsandapps and
sean-perkins
and removed request for
a team
November 29, 2023 19:54
sean-perkins
approved these changes
Nov 29, 2023
sean-perkins
left a comment
Contributor
There was a problem hiding this comment.
Great work 👍 filling in the unit test coverage for the other shadow parts was a good improvement too!
I wonder if we should create a test util or custom selector to cut down on the boiler plate to follow this mentality with all our shadow dom components.
e.g.:
expect(range).toHaveShadowPart('label');Not necessary as part of this!
mapsandapps
approved these changes
Nov 29, 2023
Issue number: N/A
---------
<!-- 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?
<!-- Please describe the current behavior that you are modifying. -->
## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->
- Adds a custom matcher to the jest configuration for Stencil to enable
using `expect(el).toHaveShadowPart('partName')`
## Does this introduce a breaking change?
- [ ] Yes
- [x] No
<!-- If this introduces a breaking change, please describe the impact
and migration path for existing applications below. -->
## Other information
<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->
This file contains hidden or 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
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-range. 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?
labelshadow part toion-rangeDoes this introduce a breaking change?
Other information
Similar to #28585, I investigated to see if
pointer-events: nonewas still needed onionic-framework/core/src/components/range/range.scss
Line 224 in 34417a5
This code was originally added for
ion-input: 9a9568c. However, I was not able to reproduce the original issue withion-range(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. Also the fact that this was only applied to the slotted label and not thelabelprop content also makes me think this is not needed for range.I removed the code from
ion-range. However, authors should still verify if this code is needed for each of the remaining features (checkbox and radio).