-
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
fix(range): range knob does not overflow in item #27188
Conversation
Run & review this pull request in StackBlitz Codeflow. |
The updated syntax/screenshots appear to have caught a visual bug with the knob positioning/clipping when used without a label. I'll circle back to confirming that + opening a bug report if that is the case. |
<!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- 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. --> Developers that are using Ionic v7 are experiencing an issue where implementations that are intended to use the modern control syntax will render with the legacy syntax and a warning will be displayed. The issue is most easily reproduced by not assigning a label to the control and then asynchronously assigning a label after a duration. Angular example: ```html <ion-item> <ion-input [label]="label"></ion-input> </ion-item> ``` ```ts @component({ ... }) export class MyComponent { @input() label?: string; // initially unset ngOnInit() { setTimeout(() => this.label = 'Hello world', 500); } } ``` <!-- Issues are required for both bug fixes and features. --> Issue URL: resolves #27085 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Form controls that do not have a decorative label or `aria-label`/`aria-labelledby` assigned, will default render as modern controls. - Legacy form implementations that render an `<ion-label>` within the item, will continue to render with the legacy template and a warning will be displayed in the console. - Modern form syntax supports dynamically set labels ## 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. --> Legacy implementations that do not have a decorative label and do not specify `aria-label` on the control, will be upgraded to the modern syntax. For example: ```html <ion-item> <ion-input></ion-input> </ion-item> ``` Developers that do not want to update to the modern syntax yet should add the `legacy="true"` attribute to their form control. ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev-build: `7.0.2-dev.11681157690.1060bc7f` When migrating the range tests to modern syntax, I observed a visual clipping issue. This is being addressed in: #27188. This PR simply adds the legacy flag so that screenshots are the same as `main`.
<!-- Please refer to our contributing documentation for any questions on submitting a pull request, or let us know here if you need any help: https://ionicframework.com/docs/building/contributing --> <!-- Some docs updates need to be made in the `ionic-docs` repo, in a separate PR. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#modifying-documentation for details. --> <!-- 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. --> Developers that are using Ionic v7 are experiencing an issue where implementations that are intended to use the modern control syntax will render with the legacy syntax and a warning will be displayed. The issue is most easily reproduced by not assigning a label to the control and then asynchronously assigning a label after a duration. Angular example: ```html <ion-item> <ion-input [label]="label"></ion-input> </ion-item> ``` ```ts @component({ ... }) export class MyComponent { @input() label?: string; // initially unset ngOnInit() { setTimeout(() => this.label = 'Hello world', 500); } } ``` <!-- Issues are required for both bug fixes and features. --> Issue URL: resolves #27085 ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Form controls that do not have a decorative label or `aria-label`/`aria-labelledby` assigned, will default render as modern controls. - Legacy form implementations that render an `<ion-label>` within the item, will continue to render with the legacy template and a warning will be displayed in the console. - Modern form syntax supports dynamically set labels ## 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. --> Legacy implementations that do not have a decorative label and do not specify `aria-label` on the control, will be upgraded to the modern syntax. For example: ```html <ion-item> <ion-input></ion-input> </ion-item> ``` Developers that do not want to update to the modern syntax yet should add the `legacy="true"` attribute to their form control. ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev-build: `7.0.2-dev.11681157690.1060bc7f` When migrating the range tests to modern syntax, I observed a visual clipping issue. This is being addressed in: #27188. This PR simply adds the legacy flag so that screenshots are the same as `main`.
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.
I didn't review the tests since I expect them to change after resolving the conflicts.
a67c3c3
to
198e3a9
Compare
I need to dig into this screenshot test: The current style changes target |
Ok, I dug into this further and I am no longer concerned with that screenshot diff. The reason for clipping is that the bounding box does not contain the knob overflow: So when playwright captures the element screenshot, it results in the clipped appearance. In an application, this should not occur (unless they have a container with Once CI passes, I think this is ready for review to see if the team is in favor of the approach for solving this bug. Open to other ideas/suggestions as well 👍 |
...ge/test/label/range.e2e.ts-snapshots/range-no-items-no-label-ios-ltr-Mobile-Chrome-linux.png
Show resolved
Hide resolved
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.
Everything looks good. One thing that I noticed is that the focused blue circle is getting clipped when there isn't an icon when moving the knob either far right or far left.
Is it possible to have the focused circle to render on top?
Screen.Recording.2023-07-12.at.11.23.15.AM.mov
@thetaPC here's an approach we could take: Kapture.2023-07-12.at.15.39.11.mp4It requires bumping the default padding from Thoughts? I think if we do this, we should target for a minor release since we are adjusting default values in pursuit of correcting visual issues. |
2 pixels feels like a lot. I do agree that if we make this change then it should be a minor. I'm leaning towards starting a with the rest of the team for their thoughts. Otherwise, your solution works but wondering if it could lead to issues later. |
This prevents the focus indicator in MD from being clipped when there is no start icon or label with the ion-range.
f3ed1b0
to
02c1d61
Compare
Closing this PR in favor of #28199 |
Issue number: resolves #27199 --------- <!-- 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. --> When using the modern range in an item, the knob will get cut off by the item when the value is at either the min or the max. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Range knob is no longer cut off by the item ## 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 is an extension of #27188. I decided to make a separate branch/PR since I added tests and changed the implementation a bit. Feel free to take all/some/none of this code. --------- Co-authored-by: Sean Perkins <[email protected]> Co-authored-by: ionitron <[email protected]>
Issue number: resolves #27199 --------- <!-- 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. --> When using the modern range in an item, the knob will get cut off by the item when the value is at either the min or the max. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Range knob is no longer cut off by the item ## 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 is an extension of #27188. I decided to make a separate branch/PR since I added tests and changed the implementation a bit. Feel free to take all/some/none of this code. --------- Co-authored-by: Sean Perkins <[email protected]> Co-authored-by: ionitron <[email protected]>
Issue number: resolves #27199 --------- <!-- 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. --> When using the modern range in an item, the knob will get cut off by the item when the value is at either the min or the max. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Range knob is no longer cut off by the item ## 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 is an extension of #27188. I decided to make a separate branch/PR since I added tests and changed the implementation a bit. Feel free to take all/some/none of this code. --------- Co-authored-by: Sean Perkins <[email protected]> Co-authored-by: ionitron <[email protected]>
What is the current behavior?
The range knob will clip when displayed without a label inside of
ion-item
.Additionally, there are legacy range tests that do not use the correct syntax.
Issue URL: #27199
What is the new behavior?
ion-item
with the modern form syntaxlegacy="true"
Does this introduce a breaking change?
Other information