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

Merged
merged 4 commits into from
Nov 30, 2023
Merged

Conversation

liamdebeasi
Copy link
Contributor

@liamdebeasi liamdebeasi commented Nov 29, 2023

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?

  • Adds a label shadow part to ion-range

Does this introduce a breaking change?

  • Yes
  • No

Other information

Similar to #28585, I investigated to see if pointer-events: none was still needed on

.

This code was originally added for ion-input: 9a9568c. However, I was not able to reproduce the original issue with ion-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 the label 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).

@github-actions github-actions bot added the package: core @ionic/core package label 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);
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.

@liamdebeasi liamdebeasi changed the title Fw 5614 feat(range): expose label wrapper as shadow part Nov 29, 2023
@liamdebeasi liamdebeasi marked this pull request as ready for review November 29, 2023 19:54
@liamdebeasi liamdebeasi requested a review from a team as a code owner November 29, 2023 19:54
@liamdebeasi liamdebeasi requested review from sean-perkins and mapsandapps and removed request for a team November 29, 2023 19:54
Copy link
Contributor

@sean-perkins sean-perkins left a 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. -->
@liamdebeasi liamdebeasi merged commit 52ed2bf into feature-7.6 Nov 30, 2023
44 checks passed
@liamdebeasi liamdebeasi deleted the FW-5614 branch November 30, 2023 15:36
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