Skip to content

Bug Report: Semantics Assertion Failure with FTextField #808

@haijd

Description

@haijd

Description

When using FResizable component in a Flutter application, the app triggers continuous semantics-related assertion failures that cascade into rendering pipeline errors. This makes the application unstable and fills the console with error messages.

Environment

  • Forui Version: 0.17.0
  • Flutter Version: 3.10.4+
  • Dart SDK: ^3.10.4
  • Platform: Linux (also likely affects other platforms)
  • Framework: Using Rinf for Flutter-Rust interop

Error Messages

Primary Error

'package:flutter/src/semantics/semantics.dart': Failed assertion: line 4392 pos 16:
'node.parent == null || !node.parent!.isPartOfNodeMerging || node.isMergedIntoParent': is not true.

Secondary Errors (Cascading)

'package:flutter/src/widgets/binding.dart': Failed assertion: line 1240 pos 16:
'debugFrameWasSentToEngine': is not true.

'package:flutter/src/semantics/semantics.dart': Failed assertion: line 4406 pos 14:
'node.parent?._dirty != true': is not true.

Stack Trace

#2      SemanticsOwner.sendSemanticsUpdate (package:flutter/src/semantics/semantics.dart:4392:16)
#3      PipelineOwner.flushSemantics (package:flutter/src/rendering/object.dart:1512:24)
#4      PipelineOwner.flushSemantics (package:flutter/src/rendering/object.dart:1514:15)
#5      RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:636:25)
#6      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:1264:13)
#7      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:495:5)
#8      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1434:15)
#9      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1347:9)
#10     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:1057:9)

Steps to Reproduce

Minimal Code Example

import 'package:flutter/cupertino.dart';
import 'package:forui/forui.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      builder: (context, child) {
        return FAnimatedTheme(
          data: FThemes.zinc.light,
          child: child!,
        );
      },
      home: const HomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    final media = MediaQuery.of(context);
    final initWidth = media.size.width / 2;

    return FResizable(
      axis: Axis.horizontal,
      divider: FResizableDivider.divider,
      children: [
        FResizableRegion(
          initialExtent: initWidth,
          minExtent: 256,
          builder: (context, data, _) => Container(color: const Color(0xFFE0E0E0)),
        ),
        FResizableRegion(
          initialExtent: initWidth,
          minExtent: 482,
          builder: (context, data, _) => Container(color: const Color(0xFFF5F5F5)),
        )
      ],
    );
  }
}

Steps

  1. Create a new Flutter project with forui: ^0.17.0
  2. Add the minimal code above
  3. Run the application: flutter run
  4. Observe the console output showing continuous assertion failures

Expected Behavior

The FResizable component should render without triggering semantics assertion failures.

Actual Behavior

  • Application starts but immediately triggers semantics assertion failures
  • Errors continue to appear repeatedly (hundreds of times)
  • The errors cascade from semantics to rendering pipeline
  • Application may still function but is unstable

Workaround

The issue can be temporarily bypassed by excluding the semantics tree at the app level:

CupertinoApp(
  builder: (context, child) {
    return FAnimatedTheme(
      data: FThemes.zinc.light,
      child: ExcludeSemantics(
        child: child!,
      ),
    );
  },
  home: const HomePage(),
)

Note: This workaround disables accessibility features for the entire application.

Root Cause Hypothesis

The FResizable component appears to have an issue with how it manages its semantics tree during initialization or rendering. The error suggests that a semantics node is being merged into a parent incorrectly, or the parent-child relationship in the semantics tree is inconsistent.

Impact

  • Severity: High - Makes applications unstable and unusable without workaround
  • Accessibility: Workaround requires disabling semantics, breaking screen readers
  • User Experience: Console spam makes debugging other issues difficult

Additional Context

This issue was discovered while building a desktop application using Forui components. The error appears immediately on application launch and persists throughout the app lifecycle.

Related Components

  • FResizable
  • FResizableRegion
  • FResizableDivider
  • Possibly FAnimatedTheme (though less likely)

Would appreciate any guidance on this issue. Happy to provide additional information or test fixes if needed.

Metadata

Metadata

Assignees

Labels

priority: highRequires urgent attention, i.e. those that block progress of other featurestype: bugA defect

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions