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

Upgrade to Ionic 6 #2380

Merged
merged 42 commits into from
Aug 16, 2022
Merged

Upgrade to Ionic 6 #2380

merged 42 commits into from
Aug 16, 2022

Conversation

RasmusKjeldgaard
Copy link
Collaborator

@RasmusKjeldgaard RasmusKjeldgaard commented Jun 28, 2022

Which issue does this PR close?

Fixes #1932, fixes #1009, fixes #2260

What is the new behavior?

Upgraded to the newest Ionic version at the time of speaking, and made the necessary changes as per the upgrade guide.

This is mostly style refactorings to the modal to account for the new shadow root.
Furthermore, there are some changes to the Modal Animation Builder, as the modal was no longer animating correctly.
The animation builder is essentially just holding a copy of the enter/leave animations from Ionic, with some adjustments to account for removing the opacity on stacked backdrops.

Does this PR introduce a breaking change?

  • Yes
  • No

Are there any additional context?

With the new update we are seeing a boatload of these warnings in the console whenever a modal is opened:

[Ionic Warning]: swipeToClose has been deprecated in favor of canDismiss.

If you want a card modal to be swipeable, set canDismiss to `true`. In the next major release of Ionic, swipeToClose will be removed, and all card modals will be swipeable by default.

I tried switching to canDismiss, but this does not seem to work for our drawer, as it is not a card modal. We will have to leave it to a followup issue to remove the deprecated functionality, before it is completely removed from Ionic.

Checklist:

The following tasks should be carried out in sequence in order to follow the process of contributing correctly.

Reminders

  • Make sure you have implemented tests following the guidelines in: "The good: Test".
  • Make sure you have updated the cookbook with examples and showcases (for bug fixes, enhancements & new components).

Review

  • Do a self-review.
  • Request that the changes are code-reviewed
  • Request that the changes are UX reviewed (only necessary if your PR introduces visual changes)

When the pull request has been approved it will be merged to develop by Team Kirby.

@RasmusKjeldgaard RasmusKjeldgaard force-pushed the housekeeping/1932-ionic-6-second branch 2 times, most recently from d7afd0c to 92a7d0d Compare June 28, 2022 10:56
Copy link
Collaborator

@jkaltoft jkaltoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general the styling changes look sane. Nice with a bit of clean-up.

@RasmusKjeldgaard RasmusKjeldgaard force-pushed the housekeeping/1932-ionic-6-second branch 2 times, most recently from 8cfaad4 to 9ddefe6 Compare August 2, 2022 14:49
@RasmusKjeldgaard RasmusKjeldgaard changed the title Housekeeping/1932 ionic 6 second Upgrade to Ionic 6 Aug 3, 2022
@github-actions github-actions bot temporarily deployed to pr-1932-ionic-6-second August 3, 2022 12:07 Inactive
This change allows us to remove all the custom animation logic
that was copied from Ionics code base, and enhanced with some
logic for reducing the opacity of underlying modals. This was no longer
working with Ionic 6, and had to be refactored or removed.

The cost of this change is that modal backdrop opacity now stacks,
so the background gets darker and darker with nested modals.
Text is already centered due to the empty state component
which wraps all alert content.
We are scaling and moving the modal in unexpected ways to position
the action sheet. Previously we were able to hide the modal shadow
element that has the wrong size and position via CSS but it is now
encapsulated and not exposed via a part in Ionic 6. Therefore it is
removed instead.
This way all the modal elements that use the custom properties
(modal shadow, modal content etc) get the proper sizes and so on.
The modal-wrapper component and its ion-modal parent
is now separated by a shadow-dom, which means that nativeElement.closest
no longer works, and an alternative approach for adding the full-height
css class is needed.

The solution has also been slightly refactored so the class is added to
the ion-modal element instead, now the using custom css properties of
that component.
These are now set via ion-modal --border-radius elsewhere and should
properly cascade throughout the modal as a result of that.
Leave it to ionic to make the modal go all the way to the edge on small
devices, effectively hiding the box shadow
As we are no longer testing the specific ionic implementation we can
remove the different size scenarios as none of tests are based on
the screen dimensions anymore.
We now use the default backdrop behavior from Ionic and should
therefore not need to test this.
Instead of duplicating tests for both phone and tablet/desktop we
now only test the special cases whenever it should be different on
phone.

Unfortunately I also accidentally bundled in a general cleanup with this
commit. Sorry future someone, I owe you!
This way we avoid custom functionality to traverse the DOM from the
modal wrapper that is now placed inside a slot.
It has now been refactored to work with the new Ionic 6 animations
implemented in the previous commit.
@RasmusKjeldgaard RasmusKjeldgaard force-pushed the housekeeping/1932-ionic-6-second branch from 42942e8 to 760920a Compare August 3, 2022 12:17
@github-actions github-actions bot temporarily deployed to pr-1932-ionic-6-second August 3, 2022 12:55 Inactive
@RasmusKjeldgaard RasmusKjeldgaard requested review from jkaltoft and MadsBuchmann and removed request for MadsBuchmann August 3, 2022 13:35
@github-actions github-actions bot temporarily deployed to pr-1932-ionic-6-second August 4, 2022 13:37 Inactive
jkaltoft
jkaltoft previously approved these changes Aug 5, 2022
Copy link
Collaborator

@jkaltoft jkaltoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work, The Rasmus™

giphub

jkaltoft
jkaltoft previously approved these changes Aug 10, 2022
Adding a short timeout when waiting for ResizeObserver in modal helper
test seems to fix failing tests
@github-actions github-actions bot temporarily deployed to pr-1932-ionic-6-second August 10, 2022 11:29 Inactive
@github-actions github-actions bot temporarily deployed to pr-1932-ionic-6-second August 10, 2022 12:18 Inactive
@github-actions github-actions bot temporarily deployed to pr-1932-ionic-6-second August 10, 2022 13:05 Inactive
@jkaltoft jkaltoft merged commit 0cc63af into develop Aug 16, 2022
@jkaltoft jkaltoft deleted the housekeeping/1932-ionic-6-second branch August 16, 2022 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants