-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Closed
Copy link
Labels
a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)f: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Description
Currently, it's not possible to update Focus's semantics under FocusableActionDetector.
FocusableActionDetector needs to provide a parameter for Focus's semantics. For cases, when you need focus but without semantics just like the Focus.includeSemantics widget.
I ran into an issue in #115285 where the Focus's semantics take over Slider semantics and it's not possible to focus on Slider from Slider's own semantics.
code sample
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
showSemanticsDebugger: true,
home: Example(),
);
}
}
class Example extends StatefulWidget {
const Example({super.key});
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
FocusNode focusNode1 = FocusNode();
FocusNode focusNode2 = FocusNode();
@override
void dispose() {
focusNode1.dispose();
focusNode2.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
FocusableActionDetector(
focusNode: focusNode1,
onFocusChange: (bool value) {
print('FocusableActionDetector.onFocusChange called');
},
// includeFocusSemantics: false, // This is passed to internal Focus widget.
child: Container(
width: 50,
height: 50,
color: Colors.red,
),
),
Focus(
focusNode: focusNode2,
onFocusChange: (bool value) {
print('Focus.onFocusChange called');
},
includeSemantics: false,
child: Container(
width: 50,
height: 50,
color: Colors.blue,
),
)
],
),
),
);
}
}
| Current | Expected |
|---|---|
![]() |
![]() |
Metadata
Metadata
Assignees
Labels
a: accessibilityAccessibility, e.g. VoiceOver or TalkBack. (aka a11y)Accessibility, e.g. VoiceOver or TalkBack. (aka a11y)f: focusFocus traversal, gaining or losing focusFocus traversal, gaining or losing focusframeworkflutter/packages/flutter repository. See also f: labels.flutter/packages/flutter repository. See also f: labels.
Type
Projects
Status
Done (PR merged)

