Skip to content

feat(item-sliding): add automatic full expand animation of items#31036

Open
OS-pedrolourenco wants to merge 20 commits intonextfrom
ROU-12664
Open

feat(item-sliding): add automatic full expand animation of items#31036
OS-pedrolourenco wants to merge 20 commits intonextfrom
ROU-12664

Conversation

@OS-pedrolourenco
Copy link
Contributor

@OS-pedrolourenco OS-pedrolourenco commented Mar 25, 2026

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?

  • Now, once the new threshold is passed and the mouse button is released, a full expand animation will take place and, after it is finished, only then is the full swipe event triggered and the item returns to its initial state where no options are visible.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Preview

@github-actions github-actions bot added the package: core @ionic/core package label Mar 25, 2026
@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment Mar 26, 2026 5:17pm

Request Review

@OS-pedrolourenco OS-pedrolourenco marked this pull request as ready for review March 26, 2026 16:04
@OS-pedrolourenco OS-pedrolourenco requested a review from a team as a code owner March 26, 2026 16:04
ShaneK and others added 11 commits March 26, 2026 16:13
…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)
|
![age](https://developer.mend.io/api/mc/badges/age/npm/@axe-core%2fplaywright/4.11.1?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@axe-core%2fplaywright/4.11.0/4.11.1?slim=true)
| 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)
|
![age](https://developer.mend.io/api/mc/badges/age/npm/@playwright%2ftest/1.58.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@playwright%2ftest/1.56.1/1.58.2?slim=true)
| devDependencies | minor |
| mcr.microsoft.com/playwright | `v1.56.1` → `v1.58.2` |
![age](https://developer.mend.io/api/mc/badges/age/docker/mcr.microsoft.com%2fplaywright/v1.58.2?slim=true)
|
![confidence](https://developer.mend.io/api/mc/badges/confidence/docker/mcr.microsoft.com%2fplaywright/v1.56.1/v1.58.2?slim=true)
| final | minor |

---

<details>
<summary>dequelabs/axe-core-npm (@&#8203;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
([#&#8203;1261](https://redirect.github.com/dequelabs/axe-core-npm/issues/1261))
([40d22e3](https://redirect.github.com/dequelabs/axe-core-npm/commit/40d22e3cd6381796d731802efc71bc21c924025e)),
closes
[#&#8203;1243](https://redirect.github.com/dequelabs/axe-core-npm/issues/1243)
- Update axe-core to v4.11.1
([#&#8203;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 (@&#8203;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)

[#&#8203;39036](https://redirect.github.com/microsoft/playwright/issues/39036)
fix(msedge): fix local network permissions

[#&#8203;39037](https://redirect.github.com/microsoft/playwright/issues/39037)
chore: update cft download location

[#&#8203;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>
Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

The functionality is working well. 🎉 Requested some changes related to the tests!

Copy link
Member

Choose a reason for hiding this comment

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

There is some weirdness going on with the headings in ios:

Image


<ion-content>
<div class="ion-padding-start" style="padding-top: 30px">
<ion-title>Full Swipe - Expandable Options</ion-title>
Copy link
Member

Choose a reason for hiding this comment

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

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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//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
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
//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);
Copy link
Member

Choose a reason for hiding this comment

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

Can we break this into individual examples using page.setContent? Like this:

test('should not have visual regressions when containing text', async ({ page }) => {
await page.setContent(
`
<ion-avatar shape="round">AB</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-shape-round-text`));
});
test('should not have visual regressions when containing an icon', async ({ page }) => {
await page.setContent(
`
<ion-avatar shape="round">
<ion-icon name="person-outline"></ion-icon>
</ion-avatar>
`,
config
);
const avatar = page.locator('ion-avatar');
await expect(avatar).toHaveScreenshot(screenshot(`avatar-shape-round-icon`));
});

await dragElementBy(item, page, -190);
await page.waitForTimeout(FULL_ANIMATION_MS);

expect(ionSwipe.length).toBeGreaterThan(0);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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;
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need a separate test for RTL? We should be able to use this on all the other tests.

Copy link
Member

@ShaneK ShaneK left a comment

Choose a reason for hiding this comment

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

Good start! Noticed some accidental breaking changes that will need to be addressed first though

}

const state = this.state;
this.setOpenAmount(restingPoint, true);
Copy link
Member

Choose a reason for hiding this comment

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

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?

Copy link
Member

Choose a reason for hiding this comment

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

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');
Copy link
Member

Choose a reason for hiding this comment

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

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(() => {
Copy link
Member

Choose a reason for hiding this comment

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

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');
Copy link
Member

Choose a reason for hiding this comment

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

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);
Copy link
Member

Choose a reason for hiding this comment

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

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;
Copy link
Member

Choose a reason for hiding this comment

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

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().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants