-
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(popover): inline popover positioning with fit-content or auto width #26230
Conversation
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 tested this on a Samsung Galaxy S3 and the changes worked correctly in the sample application. I did not note any major performance degredation.
However, this is an API change so we need to target a feature branch. Alternatively, is there a way we can pull this logic into ion-popover
and ion-modal
?
Something like the following:
async present() {
/**
* Check to see if the .ion-page element has not been added
* You could also check to see if this component is inline
*/
if (doesNotHaveIonPageElement) {
/**
* Fire the ionMount event
* The framework wrappers will need to listen for ionMount instead of willPresent
*/
this.ionMount.emit();
/**
* Wait one raf
* Alternatively, can use the delegateController to detect when
* the JS Framework has mounted the inner content? If not, then the raf
* is probably fine.
*/
await waitOneFrame();
}
// regular present logic
present();
}
This should have the same functionality as your current approach but without any feature changes to the animation library, letting us get this fix into a patch instead of a minor. This code also has a fast track for controller and keepContentsMounted
popovers which lets it skip the raf
.
With moving this logic to the component-layer, it would introduce an additional Personally, I would rather target this change for Thoughts? |
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'm fine with either option, but I think it's strange to change the public API of all overlay components in addition to page transitions to fix a bug only currently found in ion-popover
.
If developers are creating a custom popover animation they are still going to need to read the dimensions of the component to position the popover correctly (unless the custom popovers always have a fixed dimension, though that is a risk for both implementations), and the alternative implementation fixes the issue for custom animations too. With the original fix, developers would need to update their transition to make use of a requestAnimationFrame
and a Promise.
Pull request checklist
Please check if your PR fulfills the following requirements:
ionic-docs
repo, in a separate PR. See the contributing guide for details.npm run build
) was run locally and any changes were pushednpm run lint
) has passed locally and any fixes were made for failuresPull request type
Please check the type of change your PR introduces:
What is the current behavior?
Inline popovers with a width of
auto
orfit-content
are incorrectly positioned when the popover is presented.This bug would apply to any enter animation for overlays that relies on the dimensions of the content inside of the overlay, to position the overlay during the transition.
Issue URL: #24716
What is the new behavior?
auto
orfit-content
are positioned correctly when presented.AnimationBuilder
can be resolved asynchronously, to handle animations that require additional async operationsDoes this introduce a breaking change?
Other information