Shopify / Shopify/flash-list

Web: Selecting text across multiple items in FlashList doesn’t work as expected

Open
#1,839 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug P2 v2.0
Dominant language
TypeScript
Stars
7.2k
Forks
393
Avg merge
1d 3h
Merged PRs (30d)
1

Description

Current behavior

Attempting to select text that spans more than one list item fails on Web. When you click and drag to select from one row into the next:

The selection highlight stops at the end of the first item,

  • or it “jumps”/resets when crossing an item boundary,
  • or only the last item under the cursor becomes selected.

This makes it impossible to select continuous text across multiple rendered rows.

I suspect this happens because items are recycled and absolutely positioned, so the DOM tree order does not match the visual order. Native browser selection uses DOM order to determine anchor/focus, which likely breaks when nodes are reused or out of order.

https://github.com/user-attachments/assets/453730c0-962c-4689-97cf-cea206fa3d01

Expected behavior

Dragging to select should allow continuous selection across multiple list items in visual (top-to-bottom) order—just like a normal list/scroll view without recycling.

To Reproduce

import { FlashList } from "@shopify/flash-list";
import { Text, View } from "react-native";

export default function HomeScreen() {
  return (
    <View
      style={{
        alignItems: "center",
        width: 400,
        maxWidth: 400,
        height: 600,
      }}
    >
      <FlashList
        data={Array.from({ length: 100 }, (_, index) => index)}
        renderItem={({ item }) => <Text>text {item}</Text>}
        ItemSeparatorComponent={() => <View style={{ height: 10 }} />}
        style={{ width: "100%", height: "100%" }}
        contentContainerStyle={{ padding: 10 }}
        maintainVisibleContentPosition={{
          autoscrollToBottomThreshold: 0.2,
          startRenderingFromBottom: true,
        }}
      />
    </View>
  );
}

Platform:

  • iOS
  • Android
  • Web

Environment

v2.0.2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided FlashList reproduction on Web with v2.0.2 and inspect how rendered rows are recycled and positioned during native browser text selection. Compare selection across multiple rows with a non-recycled list; done means dragging selects continuous text in visual top-to-bottom order without resetting at item boundaries.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
frontend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.