-
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(range): expose label wrapper as shadow part #28601
Conversation
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); |
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.
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.
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!
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. -->
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?
label
shadow part toion-range
Does this introduce a breaking change?
Other information
Similar to #28585, I investigated to see if
pointer-events: none
was 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 thelabel
prop 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).