Repository: flutter
Issue: [iOS] Pressing `´` immediately deletes the character on iPad Air, iOS 17.5 with Portuguese (Portugal) keyboard
Labels: a: text input,platform-ios,a: tablet,a: internationalization,e: OS-version specific,has reproducible steps,P3,team-text-input,triaged-text-input,found in release: 3.24,found in release: 3.26

### Steps to reproduce

1. Run the sample app in the iPad Air 13-inch emulator with iOS 17.5 with a Portuguese (Portugal) keyboard
2. Press `´` and then `a`

### Expected results

`Á` is inserted

### Actual results

`A` is inserted

### Code sample

<details open><summary>Code sample</summary>

```dart
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  runApp(
    const MaterialApp(
      home: Scaffold(
        body: TextInputExample(),
      ),
    ),
  );
}

class TextInputExample extends StatefulWidget {
  const TextInputExample({super.key});

  @override
  State<TextInputExample> createState() => _TextInputExampleState();
}

class _TextInputExampleState extends State<TextInputExample> implements DeltaTextInputClient {
  final FocusNode _focusNode = FocusNode();

  TextInputConnection? _inputConnection;
  TextEditingValue _currentEditingValue = const TextEditingValue(
    text: '',
    selection: TextSelection.collapsed(offset: 0),
  );

  @override
  void initState() {
    super.initState();
    WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
      _attach();
    });
  }

  @override
  void dispose() {
    _focusNode.dispose();
    super.dispose();
  }

  @override
  void updateEditingValueWithDeltas(List<TextEditingDelta> textEditingDeltas) {
    TextEditingValue newEditingValue = _currentEditingValue;

    for (final delta in textEditingDeltas) {
      print(delta);
      newEditingValue = delta.apply(newEditingValue);
    }

    setState(() {
      _currentEditingValue = newEditingValue;
    });
  }

  void _attach() {
    if (_inputConnection != null) {
      return;
    }
    _inputConnection = TextInput.attach(
      this,
      const TextInputConfiguration(
        enableDeltaModel: true,
        inputType: TextInputType.multiline,
        textCapitalization: TextCapitalization.sentences,
        inputAction: TextInputAction.newline,
        keyboardAppearance: Brightness.light,
      ),
    );
    _inputConnection!.show();
    _inputConnection!.setEditingState(_currentEditingValue);
  }

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Focus(
        focusNode: _focusNode,
        autofocus: true,
        child: DecoratedBox(
          decoration: BoxDecoration(border: Border.all()),
          child: Padding(
            padding: const EdgeInsets.all(8.0),
            child: Text(
              _currentEditingValue.text,
              style: const TextStyle(
                fontSize: 24,
              ),
            ),
          ),
        ),
      ),
    );
  }

  @override
  void connectionClosed() {}

  @override
  AutofillScope? get currentAutofillScope => null;

  @override
  TextEditingValue? get currentTextEditingValue => null;

  @override
  void insertTextPlaceholder(Size size) {}

  @override
  void performPrivateCommand(String action, Map<String, dynamic> data) {}

  @override
  void removeTextPlaceholder() {}

  @override
  void showAutocorrectionPromptRect(int start, int end) {}

  @override
  void showToolbar() {}

  @override
  void updateEditingValue(TextEditingValue value) {}

  @override
  void updateFloatingCursor(RawFloatingCursorPoint point) {}

  @override
  void didChangeInputControl(TextInputControl? oldControl, TextInputControl? newControl) {}

  @override
  void insertContent(KeyboardInsertedContent content) {}

  @override
  void performSelector(String selectorName) {}

  @override
  void performAction(TextInputAction action) {}
}

```

</details>


### Screenshots or Video

<details open>
<summary>Screenshots / Video demonstration</summary>

https://github.com/user-attachments/assets/ab0f1e2b-fb27-4ecf-9075-0e03f645e9bc

</details>


### Logs

<details open><summary>Logs</summary>

We can see that, right after the insertion delta we receive a deletion delta.

```console
flutter: TextEditingDeltaInsertion#aeba0(oldText, textInserted: ´, insertionOffset: 0, selection: TextSelection.collapsed(offset: 1, affinity: TextAffinity.upstream, isDirectional: false), composing: TextRange(start: 0, end: 1))
flutter: TextEditingDeltaDeletion#34156(oldText: ´, textDeleted: ´, deletedRange: TextRange(start: 0, end: 1), selection: TextSelection.collapsed(offset: 0, affinity: TextAffinity.upstream, isDirectional: false), composing: TextRange(start: -1, end: -1))
flutter: TextEditingDeltaInsertion#b979a(oldText, textInserted: A, insertionOffset: 0, selection: TextSelection.collapsed(offset: 1, affinity: TextAffinity.downstream, isDirectional: false), composing: TextRange(start: -1, end: -1))

```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
$ flutter doctor -v
[✓] Flutter (Channel master, 3.25.0-1.0.pre.153, on macOS 15.0 24A335 darwin-arm64, locale en-BR)
    • Flutter version 3.25.0-1.0.pre.153 on channel master at /Users/angelosilvestre/dev/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 17f63272a0 (5 weeks ago), 2024-08-27 19:30:17 +0000
    • Engine revision 7d751acc81
    • Dart version 3.6.0 (build 3.6.0-175.0.dev)
    • DevTools version 2.39.0-dev.15

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/angelosilvestre/Library/Android/sdk
    • Platform android-35, build-tools 34.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[!] Xcode - develop for iOS and macOS (Xcode 16.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16A242d
    ! CocoaPods 1.12.1 out of date (1.13.0 is recommended).
        CocoaPods is a package manager for iOS or macOS platform code.
        Without CocoaPods, plugins will not work on iOS or macOS.
        For more info, see https://flutter.dev/to/platform-plugins
      To update CocoaPods, see https://guides.cocoapods.org/using/getting-started.html#updating-cocoapods

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] VS Code (version 1.93.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.98.0

[✓] Connected device (4 available)
    • iPad Air 13-inch (M2) (mobile)  • 9D3D13AF-EA1C-47A8-AADF-DEBF72D2C99E • ios            •
      com.apple.CoreSimulator.SimRuntime.iOS-17-5 (simulator)
    • macOS (desktop)                 • macos                                • darwin-arm64   • macOS 15.0 24A335 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad                • darwin         • macOS 15.0 24A335 darwin-arm64
    • Chrome (web)                    • chrome                               • web-javascript • Google Chrome 129.0.6668.90

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>