Skip to content

Wrapping FleatherEditor in GestureDetector interferes with iOS selection handles #576

@jaboyc

Description

@jaboyc

Steps to Reproduce

  1. Wrap a FleatherEditor in GestureDetector
  2. Create a text selection in iOS
  3. Attempt to move the selection handles

Environment

  • OS: iOS
  • Flutter version: 3.41.1
  • Fleather version: 1.26.0

Video Demo

Without GestureDetector

ScreenRecording_02-25-2026.15-47-58_1.MP4

With GestureDetector

ScreenRecording_02-25-2026.15-46-53_1.MP4

Code Sample

import 'package:fleather/fleather.dart';
import 'package:flutter/material.dart';
import 'package:parchment/codecs.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        // Whenever anything outside of a focus-grabbing widget is tapped, unfocus the primary focus.
        final currentFocus = FocusScope.of(context);
        if (!currentFocus.hasPrimaryFocus &&
            currentFocus.focusedChild != null) {
          FocusManager.instance.primaryFocus!.unfocus();
        }
      },
      child: MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(colorScheme: .fromSeed(seedColor: Colors.deepPurple)),
        home: MyHomePage(),
      ),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final fleatherController = FleatherController(
    document: parchmentMarkdown.decode(
      'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
    ),
  );

  @override
  void dispose() {
    fleatherController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Test')),
      body: FleatherTheme(
        data: FleatherThemeData.fallback(context).copyWith(
          paragraph: TextBlockTheme(
            style: TextStyle(fontSize: 24, color: Colors.black),
            spacing: VerticalSpacing(top: 6, bottom: 10),
          ),
        ),
        child: FleatherEditor(
          controller: fleatherController,
          scrollable: true,
          scrollPhysics: AlwaysScrollableScrollPhysics(),
          expands: true,
          padding: EdgeInsets.all(16),
          readOnly: false,
          enableInteractiveSelection: true,
        ),
      ),
    );
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions