Skip to content

[web][CanvasKit] TextField with TextDirection.rtl has misplaced cursor #78550

@MarcinusX

Description

@MarcinusX

Steps to Reproduce

Only on Web
Have a TextField with textDirection that mismatches keyboard text direction (e.g. English keyboard and TextDireciton.rtl ).

import 'package:flutter/material.dart';

void main() => runApp(RtlBrokenApp());

class RtlBrokenApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        body: Padding(
          padding: const EdgeInsets.all(64),
          child: TextField(
            textDirection: TextDirection.rtl,
          ),
        ),
      ),
    );
  }
}

Reproducible on DartPad
ezgif com-gif-maker (1)

Expected results:
I expect the cursor to be always aligned to the right (like on ios/android).

Actual results:
On the web, the cursor is in the wrong place compared to ios/android. It's ALMOST aligned to the right but not exactly (it's 1, 2 chars before it).

Reproducible on Fluter 2.1.0 and 2.0.2
Originally posted in #47745 (comment)
CC @mdebbar

Metadata

Metadata

Labels

P1High-priority issues at the top of the work lista: text inputEntering text in a text field or keyboard related problemsa: typographyText rendering, possibly libtxte: web_canvaskitCanvasKit (a.k.a. Skia-on-WebGL) rendering backend for Webengineflutter/engine related. See also e: labels.found in release: 2.0Found to occur in 2.0found in release: 2.1Found to occur in 2.1found in release: 2.2Found to occur in 2.2found in release: 2.4Found to occur in 2.4has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam: skip-testAn issue used to track tests that are skipped.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions