Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Undo fixes for semantics tests
  • Loading branch information
harryterkelsen committed Jan 11, 2024
commit 86457afca67162a4a771e6d72f0036bdfb85c523
17 changes: 6 additions & 11 deletions lib/web_ui/lib/src/engine/semantics/focusable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ class Focusable extends RoleManager {
if (!_focusManager.isManaging) {
_focusManager.manage(semanticsObject.id, owner.element);
}
_focusManager.changeFocus(semanticsObject.hasFocus &&
(!semanticsObject.hasEnabledState || semanticsObject.isEnabled));
_focusManager.changeFocus(semanticsObject.hasFocus && (!semanticsObject.hasEnabledState || semanticsObject.isEnabled));
} else {
_focusManager.stopManaging();
}
Expand Down Expand Up @@ -176,7 +175,6 @@ class AccessibilityFocusManager {

void _setFocusFromDom(bool acquireFocus) {
final _FocusTarget? target = _target;
print('hit setFocus callback on ${target?.element}');

if (target == null) {
// DOM events can be asynchronous. By the time the event reaches here, the
Expand All @@ -187,16 +185,15 @@ class AccessibilityFocusManager {
EnginePlatformDispatcher.instance.invokeOnSemanticsAction(
target.semanticsNodeId,
acquireFocus
? ui.SemanticsAction.didGainAccessibilityFocus
: ui.SemanticsAction.didLoseAccessibilityFocus,
? ui.SemanticsAction.didGainAccessibilityFocus
: ui.SemanticsAction.didLoseAccessibilityFocus,
null,
);
}

/// Requests focus or blur on the DOM element.
void changeFocus(bool value) {
final _FocusTarget? target = _target;
print('calling changeFocus on $target!!!');

if (target == null) {
// If this branch is being executed, there's a bug somewhere already, but
Expand All @@ -206,8 +203,9 @@ class AccessibilityFocusManager {
// Nothing is being managed right now.
assert(() {
printWarning(
'Cannot change focus to $value. No element is being managed by this '
'AccessibilityFocusManager.');
'Cannot change focus to $value. No element is being managed by this '
'AccessibilityFocusManager.'
);
return true;
}());
return;
Expand Down Expand Up @@ -239,8 +237,6 @@ class AccessibilityFocusManager {
return;
}

print('ADDING POST UPDATE CALLBACK TO FOCUS THE ELEMENT!!!');

// Delay the focus request until the final DOM structure is established
// because the element may not yet be attached to the DOM, or it may be
// reparented and lose focus again.
Expand All @@ -253,7 +249,6 @@ class AccessibilityFocusManager {
return;
}

print('CALLING FOCUS ON ${target.element}!!!!!');
target.element.focus();
});
}
Expand Down
Loading