Skip to content

feat(item-sliding): added specific animations for ionic#31103

Open
os-davidlourenco wants to merge 8 commits intonextfrom
ROU-12715
Open

feat(item-sliding): added specific animations for ionic#31103
os-davidlourenco wants to merge 8 commits intonextfrom
ROU-12715

Conversation

@os-davidlourenco
Copy link
Copy Markdown
Contributor

@os-davidlourenco os-davidlourenco commented Apr 29, 2026

Issue number: resolves internal


What is the current behavior?

The item-slidinghas the same animations for md, iOS and Ionic

What is the new behavior?

New animations were added for the Ionic theme, including:

  • Animation for opening the item-sliding
  • Animation for closing the item-sliding
  • Animation for expandable options

New conditions were also included to ensure a smoother experience:

  • Closing item-sliding by exceeding velocity
  • Selecting an extendable option by exceeding the velocity when options are visible
  • Rubber effect when selecting the option

Does this introduce a breaking change?

  • Yes
  • No

Other information

@os-davidlourenco os-davidlourenco requested a review from a team as a code owner April 29, 2026 16:43
@os-davidlourenco os-davidlourenco added package: core @ionic/core package package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Apr 29, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

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

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment May 5, 2026 5:18pm

Request Review

@github-actions github-actions Bot removed package: angular @ionic/angular package package: vue @ionic/vue package package: react @ionic/react package labels Apr 29, 2026
Comment thread core/src/components/item-sliding/item-sliding.ionic.scss Outdated
Comment thread core/src/components/item-sliding/item-sliding.ionic.scss Outdated
Comment thread core/src/components/item-sliding/item-sliding.common.scss Outdated
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

Update the branch to be up to sync with next. We had to make changes to the item sliding tests that were causing tests that were failing while you were out. I would recommend reviewing the fix in case your tests need to be updated.

Copy link
Copy Markdown
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.

Left a comment on the ticket!

Comment on lines +453 to +459
if (opening) {
expandableOption.classList.remove('item-sliding-expandable-snapback');
expandableOption.classList.add('item-sliding-expandable-open');
} else {
expandableOption.classList.remove('item-sliding-expandable-open');
expandableOption.classList.add('item-sliding-expandable-snapback');
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the purpose of these classes? There are no styles for them in the scss files.

z-index: $z-index-item-options + 1;
pointer-events: none;
will-change: transform;
// During drag on native (ios/md), disable transition — matches former inline `transition: none`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this go in item-sliding.native.scss if it only applies to native?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything in this file can go in item-sliding.native.scss since it's the same for ios and md.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Everything in this file can go in item-sliding.native.scss since it's the same for ios and md.

this.el.classList.remove('item-sliding-ionic-confirm-item-in');
this.el.classList.add('item-sliding-ionic-confirm-item-back');
this.item.style.transform = 'translate3d(0, 0, 0)';
await this.delay(480, signal);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does 480 come from? Shouldn't it match $ion-transition-time-500?

this.el.classList.remove('item-sliding-ionic-confirm-item-back');
this.el.classList.add('item-sliding-ionic-confirm-item-in');
this.item.style.transform = `translate3d(${-offScreenPosition}px, 0, 0)`;
await this.delay(150, signal);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Where does 150 come from?

Comment on lines +557 to +558
this.el.classList.remove('item-sliding-ionic-confirm-item-back');
this.el.classList.add('item-sliding-ionic-confirm-item-in');
Copy link
Copy Markdown
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 ionic in the class name? It should be theme-agnostic but it will only apply styles for ionic.

Copy link
Copy Markdown
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

I only reviewed the test. I'll leave the rest to the current reviewers.

const FULL_ANIMATION_MS = 1100;

configs({ modes: ['ios', 'md', 'ionic-md'], directions: ['ltr', 'rtl'] }).forEach(({ title, config }) => {
configs({ modes: ['ios', 'md'], directions: ['ltr', 'rtl'] }).forEach(({ title, config }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

These are the defaults so we don't need them.

Suggested change
configs({ modes: ['ios', 'md'], directions: ['ltr', 'rtl'] }).forEach(({ title, config }) => {
configs().forEach(({ title, config }) => {

const ionSwipe = await page.spyOnEvent('ionSwipe');
const item = page.locator('ion-item-sliding');
await expect(item).toBeVisible();
await page.waitForChanges();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are these changes needed? The tests were passing before without them. I also removed them locally and the tests are passing fine without them.

/**
* Test for Ionic theme that has a different full swipe animation behavior.
*/
configs({ modes: ['ionic-md'], directions: ['ltr', 'rtl'] }).forEach(({ title, config }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The default for directions is ltr and rtl so we don't need to include them.

Suggested change
configs({ modes: ['ionic-md'], directions: ['ltr', 'rtl'] }).forEach(({ title, config }) => {
configs({ modes: ['ionic-md'] }).forEach(({ title, config }) => {

Comment on lines +189 to +192
await page.mouse.move(startX, y);
await page.mouse.down();
await page.mouse.move(endX, y, { steps: 2 }); // try 1–3; lower = faster
await page.mouse.up();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are we not using our dragElementBy util? The same question for the other tests.

Comment on lines +183 to +184
const peek = config.direction === 'rtl' ? 120 : -120;
await dragElementBy(item, page, peek);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would this check be beneficial to add to ios and md?

expect(openAmount).toBe(0);
});

test('should NOT trigger full swipe animation for non-expandable options', async ({ page }) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't seem to be any different from the test on ios and md. Let's just merge them together.

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.

4 participants