Unverified Commit 3f926405 authored by chunhtai's avatar chunhtai Committed by GitHub

Visual selection is not adjusted when changing text selection with TalkBack (#32832)

parent 900875fd
...@@ -3032,7 +3032,8 @@ class SemanticsConfiguration { ...@@ -3032,7 +3032,8 @@ class SemanticsConfiguration {
set onSetSelection(SetSelectionHandler value) { set onSetSelection(SetSelectionHandler value) {
assert(value != null); assert(value != null);
_addAction(SemanticsAction.setSelection, (dynamic args) { _addAction(SemanticsAction.setSelection, (dynamic args) {
final Map<String, int> selection = args; assert(args != null && args is Map);
final Map<String, int> selection = args.cast<String, int>();
assert(selection != null && selection['base'] != null && selection['extent'] != null); assert(selection != null && selection['base'] != null && selection['extent'] != null);
value(TextSelection( value(TextSelection(
baseOffset: selection['base'], baseOffset: selection['base'],
......
...@@ -3939,7 +3939,7 @@ void main() { ...@@ -3939,7 +3939,7 @@ void main() {
), ignoreTransform: true, ignoreRect: true)); ), ignoreTransform: true, ignoreRect: true));
// move cursor back once // move cursor back once
semanticsOwner.performAction(inputFieldId, SemanticsAction.setSelection, <String, int>{ semanticsOwner.performAction(inputFieldId, SemanticsAction.setSelection, <dynamic, dynamic>{
'base': 4, 'base': 4,
'extent': 4, 'extent': 4,
}); });
...@@ -3947,7 +3947,7 @@ void main() { ...@@ -3947,7 +3947,7 @@ void main() {
expect(controller.selection, const TextSelection.collapsed(offset: 4)); expect(controller.selection, const TextSelection.collapsed(offset: 4));
// move cursor to front // move cursor to front
semanticsOwner.performAction(inputFieldId, SemanticsAction.setSelection, <String, int>{ semanticsOwner.performAction(inputFieldId, SemanticsAction.setSelection, <dynamic, dynamic>{
'base': 0, 'base': 0,
'extent': 0, 'extent': 0,
}); });
...@@ -3955,7 +3955,7 @@ void main() { ...@@ -3955,7 +3955,7 @@ void main() {
expect(controller.selection, const TextSelection.collapsed(offset: 0)); expect(controller.selection, const TextSelection.collapsed(offset: 0));
// select all // select all
semanticsOwner.performAction(inputFieldId, SemanticsAction.setSelection, <String, int>{ semanticsOwner.performAction(inputFieldId, SemanticsAction.setSelection, <dynamic, dynamic>{
'base': 0, 'base': 0,
'extent': 5, 'extent': 5,
}); });
......
...@@ -443,7 +443,7 @@ void main() { ...@@ -443,7 +443,7 @@ void main() {
semanticsOwner.performAction(expectedId, action, true); semanticsOwner.performAction(expectedId, action, true);
break; break;
case SemanticsAction.setSelection: case SemanticsAction.setSelection:
semanticsOwner.performAction(expectedId, action, <String, int>{ semanticsOwner.performAction(expectedId, action, <dynamic, dynamic>{
'base': 4, 'base': 4,
'extent': 5, 'extent': 5,
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment