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 20 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!
|
|
||
| <ion-content> | ||
| <div class="ion-padding-start" style="padding-top: 30px"> | ||
| <ion-title>Full Swipe - Expandable Options</ion-title> |
There was a problem hiding this comment.
You shouldn't use ion-title outside of a toolbar, this is what's causing ios to look strange. Either use an h2 like this:
<h2>Full Swipe - Expandable Options</h2>
<style>
h2 {
font-size: 12px;
font-weight: normal;
color: #6f7378;
margin-top: 10px;
margin-left: 5px;
}
</style>Or use an ion-list-header at the top of the list.
| }); | ||
| test.describe('start options', () => { | ||
| test('should not have visual regressions', async ({ page }) => { | ||
| //TODO(FW-7184): remove skip once issue is resolved |
There was a problem hiding this comment.
| //TODO(FW-7184): remove skip once issue is resolved | |
| // TODO(FW-7184): remove skip once issue is resolved |
| test.describe(title('item-sliding: basic'), () => { | ||
| test.describe('safe area left', () => { | ||
| test('should have padding on the left only', async ({ page }) => { | ||
| //TODO(FW-7184): remove skip once issue is resolved |
There was a problem hiding this comment.
| //TODO(FW-7184): remove skip once issue is resolved | |
| // TODO(FW-7184): remove skip once issue is resolved |
|
|
||
| test.describe('safe area right', () => { | ||
| test('should have padding on the right only', async ({ page }) => { | ||
| //TODO(FW-7184): remove skip once issue is resolved |
There was a problem hiding this comment.
| //TODO(FW-7184): remove skip once issue is resolved | |
| // TODO(FW-7184): remove skip once issue is resolved |
| configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr'] }).forEach(({ title, config }) => { | ||
| test.describe(title('item-sliding: full swipe'), () => { | ||
| test.beforeEach(async ({ page }) => { | ||
| await page.goto(`/src/components/item-sliding/test/full-swipe`, config); |
There was a problem hiding this comment.
Can we break this into individual examples using page.setContent? Like this:
ionic-framework/core/src/components/avatar/test/shape/avatar.e2e.ts
Lines 10 to 36 in abe3b3f
| await dragElementBy(item, page, -190); | ||
| await page.waitForTimeout(FULL_ANIMATION_MS); | ||
|
|
||
| expect(ionSwipe.length).toBeGreaterThan(0); |
There was a problem hiding this comment.
| expect(ionSwipe.length).toBeGreaterThan(0); | |
| expect(ionSwipe.length).toBe(1); |
Can we check for exactly once?
| await dragElementBy(item, page, 190); | ||
| await page.waitForTimeout(FULL_ANIMATION_MS); | ||
|
|
||
| expect(ionSwipe.length).toBeGreaterThan(0); |
There was a problem hiding this comment.
| expect(ionSwipe.length).toBeGreaterThan(0); | |
| expect(ionSwipe.length).toBe(1); |
Can we check for exactly once?
| const item = page.locator('#expandable-end'); | ||
|
|
||
| // In RTL the "end" side is on the left, revealed by dragging right | ||
| const dragByX = config.direction === 'rtl' ? 190 : -190; |
There was a problem hiding this comment.
Why do we need a separate test for RTL? We should be able to use this on all the other tests.
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
| } | ||
|
|
||
| const state = this.state; | ||
| this.setOpenAmount(restingPoint, true); |
There was a problem hiding this comment.
The original onEnd fired fireSwipeEvent() for any full swipe that reached SwipeEnd/SwipeStart state, regardless of whether any option was expandable. Now that event emission is entirely inside animateFullSwipe, which only runs when hasExpandableOptions is true, non-expandable option sets will never emit ionSwipe. Apps using (ionSwipe) on a plain ion-item-options will silently stop receiving it. Shouldn't the fall-through path (when shouldTriggerFullSwipe is false) still fire the event when state has SwipeEnd/SwipeStart?
There was a problem hiding this comment.
We should add some tests for this. I forgot we didn't have tests for events firing.
| this.state = SlidingState.Disabled; | ||
| openSlidingItem = undefined; | ||
| } finally { | ||
| el.classList.remove('item-sliding-full-swipe'); |
There was a problem hiding this comment.
openSlidingItem = undefined is inside the try block (line 348) so if anything throws before reaching it, the module-level reference stays pointing to this element. That prevents any other sliding item in the list from opening until something eventually clears it. Shouldn't this move into finally?
| this.item.style.transition = `transform ${duration}ms ease-out`; | ||
| this.item.style.transform = `translate3d(${-position}px, 0, 0)`; | ||
|
|
||
| setTimeout(() => { |
There was a problem hiding this comment.
These setTimeout IDs aren't stored anywhere, so disconnectedCallback can't cancel them. If the component unmounts mid-animation, options.fireSwipeEvent() still fires when the timer resolves since options is captured by the closure before this.leftOptions/this.rightOptions gets cleared. There's already a this.tmr pattern for exactly this. Could the timer IDs get the same treatment?
| } | ||
|
|
||
| const { el } = this; | ||
| el.classList.add('item-sliding-full-swipe'); |
There was a problem hiding this comment.
Is there a CSS rule for item-sliding-full-swipe somewhere? I don't see one in item-sliding.scss or the platform-specific variants. If it's needed so the item can animate past the list's clipping boundary (e.g. overflow: visible on the host), the rule is missing. If it's a hook for external consumers, worth a comment. Otherwise it could be dropped.
| await dragElementBy(item, page, -190); | ||
| await page.waitForTimeout(FULL_ANIMATION_MS); | ||
|
|
||
| expect(ionSwipe.length).toBeGreaterThan(0); |
There was a problem hiding this comment.
The codebase has toHaveReceivedEvent(), toHaveReceivedEventTimes(1), and not.toHaveReceivedEvent() in core/src/utils/test/playwright/matchers/. Could you use those instead of .length checks? The non-expandable test on line 62 would become expect(ionSwipe).not.toHaveReceivedEvent() as well.
| */ | ||
|
|
||
| // Full animation cycle duration (100ms expand + 250ms off-screen + 300ms delay + 250ms return) | ||
| const FULL_ANIMATION_MS = 1100; |
There was a problem hiding this comment.
FULL_ANIMATION_MS = 1100 is the sum of the hardcoded delays in animateFullSwipe (100 + 250 + 300 + 250). If any of those change, these tests start silently flaking. For the tests that check ionSwipe, could you use await ionSwipe.next() instead? That resolves as soon as the event fires without sleeping for the full cycle. The closed-state test could then follow up with page.waitForChanges().

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