feat(item-sliding): add automatic full expand animation of items#31036
feat(item-sliding): add automatic full expand animation of items#31036OS-pedrolourenco wants to merge 31 commits intonextfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…verOptions (#31022) Issue number: resolves #31012 --------- <!-- 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? `ModalOptions` and `PopoverOptions` in `@ionic/angular` are non-generic type aliases. Using `ModalOptions<typeof MyComponent>` causes a typescript error, even though the core `@ionic/core` types accept a generic parameter. ## What is the new behavior? `ModalOptions` and `PopoverOptions` now forward the generic type parameter from their core counterparts, allowing usage like` ModalOptions<typeof MyComponent>`. The default parameter preserves backward compatibility and existing code using ModalOptions without a generic should continue to work. ## Does this introduce a breaking change? - [ ] Yes - [X] No ## Other information This was the initial and intended behavior, but got broken in #30899 unintentionally. This PR fixes the issue and creates a test to ensure it doesn't happen again. Current dev build: ``` 8.8.2-dev.11773931429.15b2a51c ```
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. --> While working on the migration for the spinner to Ionic Modular, I noticed that we had a [Transform test page](https://github.com/ionic-team/ionic-framework/blob/2b5b9137fc164c2f3305e493510a884c0afbfcf0/core/src/components/spinner/test/transform/index.html#L5) without any context of why it was there. I found out that it's meant for a [bug](#19247) that was reported in v4 and we did have a [test](https://github.com/ionic-team/ionic-framework/pull/24643/changes#diff-7b7ff84d3845fbde015775aa2da960310e80f79ec01b1f4a5957d751eddce7c9R1) for it at some point but it was removed at a later date because it was [discovered](#25259) that it wasn't doing anything. So we don't have any coverage of it if there's a regression. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Added a test to prevent a regression ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> How to test: 1. Be on your local 2. Navigate to `spinner.scss` 3. Update the following code snippet: ```diff - :host(.spinner-circular) svg { + :host(.spinner-circular) { animation: spinner-circular linear infinite; } ``` 4. By making this code change, we are introducing the [original issue](https://github.com/ionic-team/ionic-framework/pull/24643/changes#diff-fa8f6fb72eceb39e2482c0dbc083f69ecdabd411be541c21947f8e8e9bf9ee48L118). 5. Run the test 6. Notice that it fails 7. Undo the code change 8. Run the test 9. Verify that it passes
Issue number: resolves internal --------- <!-- 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. --> When the user swipes to a previous month that has adjacent days and selects one of the adjacent days from a previous month, the datetime selects the day but fails to scroll to the previous month. When a user clicks on a previous adjacent day after swiping the month, the calendar scrolls to the previous month. The same is applied to the next month. - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 2. Update the BREAKING.md file with the breaking change. 3. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer for more information. --> The previous behavior was only reproducible on iOS real devices.
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | Type | Update | |---|---|---|---|---|---| | [@axe-core/playwright](https://redirect.github.com/dequelabs/axe-core-npm) | [`^4.11.0` → `^4.11.1`](https://renovatebot.com/diffs/npm/@axe-core%2fplaywright/4.11.0/4.11.1) |  |  | devDependencies | patch | | [@playwright/test](https://playwright.dev) ([source](https://redirect.github.com/microsoft/playwright)) | [`^1.56.1` → `^1.58.2`](https://renovatebot.com/diffs/npm/@playwright%2ftest/1.56.1/1.58.2) |  |  | devDependencies | minor | | mcr.microsoft.com/playwright | `v1.56.1` → `v1.58.2` |  |  | final | minor | --- <details> <summary>dequelabs/axe-core-npm (@​axe-core/playwright)</summary> [`v4.11.1`](https://redirect.github.com/dequelabs/axe-core-npm/blob/HEAD/CHANGELOG.md#4111-2026-01-09) [Compare Source](https://redirect.github.com/dequelabs/axe-core-npm/compare/v4.11.0...v4.11.1) - reorder exports to place types first ([#​1261](https://redirect.github.com/dequelabs/axe-core-npm/issues/1261)) ([40d22e3](https://redirect.github.com/dequelabs/axe-core-npm/commit/40d22e3cd6381796d731802efc71bc21c924025e)), closes [#​1243](https://redirect.github.com/dequelabs/axe-core-npm/issues/1243) - Update axe-core to v4.11.1 ([#​1271](https://redirect.github.com/dequelabs/axe-core-npm/issues/1271)) ([77f577e](https://redirect.github.com/dequelabs/axe-core-npm/commit/77f577ed47510045e75b939fa97ac1d4f91b219b)) </details> <details> <summary>microsoft/playwright (@​playwright/test)</summary> [`v1.58.2`](https://redirect.github.com/microsoft/playwright/compare/v1.58.1...ce480a952553175eae75342aad2c5e86cdf2cbba) [Compare Source](https://redirect.github.com/microsoft/playwright/compare/v1.58.1...v1.58.2) [`v1.58.1`](https://redirect.github.com/microsoft/playwright/releases/tag/v1.58.1) [Compare Source](https://redirect.github.com/microsoft/playwright/compare/v1.58.0...v1.58.1) [#​39036](https://redirect.github.com/microsoft/playwright/issues/39036) fix(msedge): fix local network permissions [#​39037](https://redirect.github.com/microsoft/playwright/issues/39037) chore: update cft download location [#​38995](https://redirect.github.com/microsoft/playwright/issues/38995) chore(webkit): disable frame sessions on fronzen builds - Chromium 145.0.7632.6 - Mozilla Firefox 146.0.1 - WebKit 26.0 [`v1.58.0`](https://redirect.github.com/microsoft/playwright/compare/v1.57.0...961381ec73a9fa2661d92504eab1a6bd6eaffc75) [Compare Source](https://redirect.github.com/microsoft/playwright/compare/v1.57.0...v1.58.0) [`v1.57.0`](https://redirect.github.com/microsoft/playwright/compare/v1.56.1...80581972582c9565e141c5fedd3c5fa10cc0e38b) [Compare Source](https://redirect.github.com/microsoft/playwright/compare/v1.56.1...v1.57.0) </details> --- 📅 **Schedule**: Branch creation - "every weekday before 11am" (UTC), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Never, or you tick the rebase/retry checkbox. 👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/ionic-team/ionic-framework). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi4xOS45IiwidXBkYXRlZEluVmVyIjoiNDMuNjYuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com> Co-authored-by: ionitron <hi@ionicframework.com>
…30983) Closes #30913 ## Description When `ion-input-otp` has the `readonly` prop set, typing is correctly blocked but users are still able to delete characters using the Backspace or Delete keys. When `disabled` or `readonly` are set, users are still able to paste into the component. ## Changes - Added guard for `disabled` and `readonly` inside `onInput` and `onPaste` handler - Prevented default behavior for `Backspace` and `Delete` when `readonly` is `true` - Return in `onKeydown` when `disabled` is `true` - Added e2e tests verifying the behavior ## How to Test 1. Add `readonly` to `ion-input-otp` 2. Attempt to type → no input allowed 3. Press Backspace/Delete → no characters removed Behavior now matches expected readonly semantics. --------- Co-authored-by: Brandy Smith <6577830+brandyscarney@users.noreply.github.com>
brandyscarney
left a comment
There was a problem hiding this comment.
The functionality is working well. 🎉 Requested some changes related to the tests!
core/src/components/item-sliding/test/basic/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
core/src/components/item-sliding/test/basic/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
core/src/components/item-sliding/test/basic/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
core/src/components/item-sliding/test/full-swipe/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
core/src/components/item-sliding/test/full-swipe/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
core/src/components/item-sliding/test/full-swipe/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
core/src/components/item-sliding/test/full-swipe/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
ShaneK
left a comment
There was a problem hiding this comment.
Good start! Noticed some accidental breaking changes that will need to be addressed first though
core/src/components/item-sliding/test/full-swipe/item-sliding.e2e.ts
Outdated
Show resolved
Hide resolved
# Conflicts: # core/src/components/badge/test/basic/badge.e2e.ts-snapshots/badge-basic-ios-rtl-Mobile-Chrome-linux.png # core/src/components/button/test/icon/button.e2e.ts-snapshots/button-icon-ios-ltr-Mobile-Chrome-linux.png # core/src/components/tab-bar/test/basic/tab-bar.e2e.ts-snapshots/tab-bar-default-ionic-md-ltr-light-Mobile-Firefox-linux.png
ShaneK
left a comment
There was a problem hiding this comment.
Looking better! A few more issues
| ? SlidingState.End | SlidingState.SwipeEnd | SlidingState.AnimatingFullSwipe | ||
| : SlidingState.Start | SlidingState.SwipeStart | SlidingState.AnimatingFullSwipe; | ||
|
|
||
| await new Promise<void>((resolve) => { |
There was a problem hiding this comment.
If disconnectedCallback fires while we're awaiting one of these, clearTimeout(this.tmr) cancels the timeout but the Promise's resolve never gets called, so the await hangs and the finally block never executes. The cleanup in disconnectedCallback (lines 122-129) partially covers this, but now there are two separate cleanup paths that need to stay in sync. Could you use a cancellation pattern so clearing the timer also resolves/rejects the promise? That way finally runs deterministically and the duplicate cleanup in disconnectedCallback isn't needed.
| } | ||
| this.openAmount = 0; | ||
| this.state = SlidingState.Disabled; | ||
| openSlidingItem = undefined; |
There was a problem hiding this comment.
This unconditionally clears openSlidingItem, but during the ~900ms animation a user could start swiping a different item. That new swipe sets openSlidingItem to the new element in onStart, and then this finally block blindly clears it, orphaning the newly-opened item. Should this use the same guard as disconnectedCallback? i.e. if (openSlidingItem === this.el) { openSlidingItem = undefined; }
| private async animateFullSwipe(direction: 'start' | 'end') { | ||
| // Prevent interruption during animation | ||
| if (this.gesture) { | ||
| this.gesture.enable(false); |
There was a problem hiding this comment.
You're disabling the gesture here to prevent interruption, but close() and open() are public @Method() calls that go through setOpenAmount and aren't gated. If someone calls close() programmatically during the animation, setOpenAmount clears this.tmr (which kills the current animation step), snaps the item, and schedules its own 600ms closing timer. The animation's promise hangs, finally never runs, and the component ends up with two competing timers. Should close()/open() check for AnimatingFullSwipe state and bail out?
| rawSwipeDistance > (direction === 'end' ? this.optsWidthRightSide : this.optsWidthLeftSide) * 0.5)); | ||
|
|
||
| if (shouldTriggerFullSwipe) { | ||
| this.animateFullSwipe(direction); |
There was a problem hiding this comment.
This is fire-and-forget with no .catch(). If the promise hangs (e.g., component disconnects mid-animation) or finally throws, the gesture stays permanently disabled from the enable(false) in animateFullSwipe. Worth adding a .catch() that re-enables the gesture as a safety net?
| */ | ||
| private getSwipeThreshold(direction: 'start' | 'end'): number { | ||
| const maxWidth = direction === 'end' ? this.optsWidthRightSide : this.optsWidthLeftSide; | ||
| return maxWidth + 30; // Slightly larger than SWIPE_MARGIN to be achievable |
There was a problem hiding this comment.
The comment says 'slightly larger than SWIPE_MARGIN' but this is exactly SWIPE_MARGIN (both 30). Should this just reference the constant? return maxWidth + SWIPE_MARGIN; That way they stay in sync if the margin ever changes.
Issue number: internal
What is the current behavior?
Dragging an ion-item with an expandable option would cause a full swipe event to be triggered but also cause the item to return to a position just after the item options once the mouse button was released.
What is the new behavior?
Does this introduce a breaking change?
Other information
Preview