Merge remote-tracking branch 'origin/GP-0_ghidragon_fixing_fieldpanel_accessibility_test'

This commit is contained in:
Ryan Kurtz
2026-06-11 12:05:26 -04:00
2 changed files with 13 additions and 4 deletions
@@ -105,7 +105,7 @@ public class AccessibleFieldPanelDelegate {
*/
public void setCaret(FieldLocation newCursorLoc, EventTrigger trigger) {
if (!panel.hasFocus()) {
if (!isFocused()) {
return;
}
@@ -151,6 +151,11 @@ public class AccessibleFieldPanelDelegate {
this.currentSelection = currentSelection;
updateCurrentFieldSelectedState(trigger);
}
// broken out so it can be overridden in a test
protected boolean isFocused() {
return panel.hasFocus();
}
private void updateCurrentFieldSelectedState(EventTrigger trigger) {
if (cursorField == null) {
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -49,7 +49,11 @@ public class AccessibleFieldPanelDelegateTest {
@Before
public void setup() {
layouts = List.of(buildAnchoredLayout(0, 0, 3), buildAnchoredLayout(1, FIELD_HEIGHT, 13));
delegate = new AccessibleFieldPanelDelegate(layouts, testContext, panel);
delegate = new AccessibleFieldPanelDelegate(layouts, testContext, panel) {
protected boolean isFocused() {
return true;
};
};
delegate.setFieldDescriptionProvider(new TestFieldDescriptionProvider());
delegate.setCaret(new FieldLocation(BigInteger.ZERO, 0, 0, 0), EventTrigger.API_CALL);