Skip to content

bug: reorder swap boundaries drift with fractional row heights #31670

Open

Description

@rtpHarry

Prerequisites

Ionic Framework Version

v9.x

Current Behavior

With fractional-height rows, the point at which dragged items swap drifts further out of alignment down the list. Reordering behaves normally near the top, but becomes noticeably incorrect further down.

Expected Behavior

The swap point should stay consistent regardless of the row's position in the list.

Steps to Reproduce

  1. Open the reproduction, which renders 300 rows with a 64.5px-high content block in each item.
  2. Drag a row near the top and observe the swap point.
  3. Scroll to around row 60, then row 120, and repeat. The swap point becomes increasingly displaced.
  4. Change the content block height from 64.5px to 65px. The drift disappears.

Code Reproduction URL

https://stackblitz.com/edit/cbvwwfdc?file=src%2Fapp%2Fexample.component.html

Ionic Info

Reproduction dependencies: @ionic/angular 9.0.10, @ionic/core 9.0.10, Angular ^22.0.0, ionicons 8.1.0.

This is the output from running npx --yes --package=@ionic/cli ionic info in the StackBlitz terminal:

Ionic:

   Ionic CLI : 7.2.1

Utility:

   cordova-res : not installed globally
   native-run  : not installed globally

System:

   NodeJS : v22.22.3
   npm    : 10.8.2
   OS     : Linux 5.0

Additional Information

The reorder group sums child.offsetHeight to cache row boundaries. A rendered height of 64.5px is rounded to 65px, accumulating a 0.5px error per row. In the affected app, the measured boundary error reaches 31.5px after 63 rows. Forcing whole-pixel row heights fixes the behavior.

Activity

  1. thetaPC commented on Oct 29, 2026

    @thetaPC
    Contributor

    Thanks for the report.

    Verified on 9.0.10, and your diagnosis is right. When a drag starts, ion-reorder-group works out where each row ends by adding up each item's offsetHeight, which is always a whole number. A 65.5px item counts as 66px, so the extra half pixel builds up row by row: the swap point is about 31px late by row 62 and 150px late by row 299. Any item with a fractional height is affected, whatever makes it fractional, in both ios and md modes.

    Workaround, verified on 9.0.10:

    • Keep item heights at whole pixels, as you found. In the reproduction, changing the content block from 64.5px to 65px brings the error to 0 at every row.

    Tracked as a bug in core.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions