Skip to content

Flutter web iframed doesn't take focus when clicking into it and receives no keyboard events #157387

@marcianx

Description

@marcianx

Steps to reproduce

  1. Requisites
    a. Accessibility (semantics tree) must not be enabled, and
    b. Flutter-web app must be iframed.
  2. Click on one of the (non-text-field) widgets within the Flutter-web app.
  3. Tab through the items using the physical keyboard.

Expected results

It should tab through items within the iframed Flutter-web content.

Actual results

The focus doesn't move into the Flutter-web iframe. Tabbing moves between items on the iframe host (wherever the focus was before clicking into the Flutter-web iframe).

Code sample

https://dartpad.dev/?id=874a9e03abdc675a741cb28e62cc9776

Code sample
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';

void main() async {
  runApp(
    MaterialApp(
      theme: ThemeData(useMaterial3: true),
      title: 'Test',
      home: Scaffold(
        body: Row(
          children: [
            IconButton(
              icon: const Icon(Icons.play_arrow, semanticLabel: 'Play movie'),
              onPressed: () {},
            ),
            IconButton(
              icon: const Icon(Icons.play_arrow, semanticLabel: 'Play movie'),
              onPressed: () {},
            ),
            IconButton(
              icon: const Icon(Icons.play_arrow, semanticLabel: 'Play movie'),
              onPressed: () {},
            ),
          ],
        ),
      ),
    ),
  );

  // ISSUE:
  // 0. Requisites: (a) Accessibility (semantics tree) must not be enabled, and Flutter-web app must be iframed.
  // 1. Click on one of the buttons (say the middle one).
  // 2. Tab through the items using the physical keyboard.
  // 
  // Expected: It should tab through items within the Flutter-web iframe.
  // Actual: The focus doesn't move into the Flutter-web iframe. Tabbing moves between items on the iframe host.
  
  // Uncomment this line to enable the Semantics tree, which makes it work properly.
  //SemanticsBinding.instance.ensureSemantics();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listcustomer: samehereengineflutter/engine related. See also e: labels.f: focusFocus traversal, gaining or losing focusplatform-webWeb applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions