Commit df265662 authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Rename NEXT focus ring to PREVIOUS for clarity

This is a pure refactor, no functional change.

TBR=dmazzoni@chromium.org

AX-Relnotes: n/a.
Bug: None
Change-Id: If8d4eb247f61e0abe1df9e32879d3641974bab1a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2438481Reviewed-by: default avatarAnastasia Helfinstein <anastasi@google.com>
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Cr-Commit-Position: refs/heads/master@{#811921}
parent 8d50ec99
...@@ -49,7 +49,7 @@ class FocusRingManager { ...@@ -49,7 +49,7 @@ class FocusRingManager {
} }
/** /**
* Sets the primary and next focus rings based on the current primary and * Sets the primary and preview focus rings based on the current primary and
* group nodes used for navigation. * group nodes used for navigation.
* @param {!SAChildNode} node * @param {!SAChildNode} node
*/ */
...@@ -64,12 +64,12 @@ class FocusRingManager { ...@@ -64,12 +64,12 @@ class FocusRingManager {
manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = []; manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [];
// Clear the dashed ring between transitions, as the animation is // Clear the dashed ring between transitions, as the animation is
// distracting. // distracting.
manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = []; manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = [];
manager.updateFocusRings_(); manager.updateFocusRings_();
// The dashed focus ring should not be shown around the menu when exiting. // The dashed focus ring should not be shown around the menu when exiting.
if (!MenuManager.isMenuOpen()) { if (!MenuManager.isMenuOpen()) {
manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects =
[backButton.group.location]; [backButton.group.location];
manager.updateFocusRings_(); manager.updateFocusRings_();
} }
...@@ -83,13 +83,14 @@ class FocusRingManager { ...@@ -83,13 +83,14 @@ class FocusRingManager {
true /* shouldRecover */); true /* shouldRecover */);
} }
// If the primary node is a group, show its first child as the "next" focus. // If the primary node is a group, show its first child as the "preview"
// focus.
if (node.isGroup()) { if (node.isGroup()) {
const firstChild = node.asRootNode().firstChild; const firstChild = node.asRootNode().firstChild;
// Clear the dashed ring between transitions, as the animation is // Clear the dashed ring between transitions, as the animation is
// distracting. // distracting.
manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = []; manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = [];
manager.updateFocusRings_(); manager.updateFocusRings_();
let focusRect = node.location; let focusRect = node.location;
...@@ -99,7 +100,7 @@ class FocusRingManager { ...@@ -99,7 +100,7 @@ class FocusRingManager {
// expand to contain the child rect. // expand to contain the child rect.
focusRect = RectUtil.expandToFitWithPadding( focusRect = RectUtil.expandToFitWithPadding(
SAConstants.Focus.GROUP_BUFFER, focusRect, childRect); SAConstants.Focus.GROUP_BUFFER, focusRect, childRect);
manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = [childRect]; manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = [childRect];
} }
manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [focusRect]; manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [focusRect];
manager.updateFocusRings_(); manager.updateFocusRings_();
...@@ -107,7 +108,7 @@ class FocusRingManager { ...@@ -107,7 +108,7 @@ class FocusRingManager {
} }
manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [node.location]; manager.rings_.get(SAConstants.Focus.ID.PRIMARY).rects = [node.location];
manager.rings_.get(SAConstants.Focus.ID.NEXT).rects = []; manager.rings_.get(SAConstants.Focus.ID.PREVIEW).rects = [];
manager.updateFocusRings_(); manager.updateFocusRings_();
} }
...@@ -133,8 +134,8 @@ class FocusRingManager { ...@@ -133,8 +134,8 @@ class FocusRingManager {
secondaryColor: SAConstants.Focus.SECONDARY_COLOR secondaryColor: SAConstants.Focus.SECONDARY_COLOR
}; };
const nextRing = { const previewRing = {
id: SAConstants.Focus.ID.NEXT, id: SAConstants.Focus.ID.PREVIEW,
rects: [], rects: [],
type: chrome.accessibilityPrivate.FocusType.DASHED, type: chrome.accessibilityPrivate.FocusType.DASHED,
color: SAConstants.Focus.PRIMARY_COLOR, color: SAConstants.Focus.PRIMARY_COLOR,
...@@ -143,7 +144,7 @@ class FocusRingManager { ...@@ -143,7 +144,7 @@ class FocusRingManager {
return new Map([ return new Map([
[SAConstants.Focus.ID.PRIMARY, primaryRing], [SAConstants.Focus.ID.PRIMARY, primaryRing],
[SAConstants.Focus.ID.NEXT, nextRing] [SAConstants.Focus.ID.PREVIEW, previewRing]
]); ]);
} }
......
...@@ -132,8 +132,9 @@ const SAConstants = { ...@@ -132,8 +132,9 @@ const SAConstants = {
ID: { ID: {
// The ID for the ring showing the user's current focus. // The ID for the ring showing the user's current focus.
PRIMARY: 'primary', PRIMARY: 'primary',
// The ID for the ring showing the next focus. // The ID for the ring showing a preview of the next focus, if the user
NEXT: 'next', // selects the current element.
PREVIEW: 'preview',
// The ID for the area where text is being input. // The ID for the area where text is being input.
TEXT: 'text' TEXT: 'text'
}, },
......
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