-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changing Scenes shows the keyboard grab cue again #354
Comments
I'll take a look |
Fixed in this patch. @zepumph can you please review? You can commit the patch if all is well: Subject: [PATCH] Add tolerance to support inaccurate stepMasses, see https://github.com/phetsims/density-buoyancy-common/issues/351
---
Index: density-buoyancy-common/js/common/view/MassView.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/density-buoyancy-common/js/common/view/MassView.ts b/density-buoyancy-common/js/common/view/MassView.ts
--- a/density-buoyancy-common/js/common/view/MassView.ts (revision bc64def88a94349258c83284b9f4d88cab6020b2)
+++ b/density-buoyancy-common/js/common/view/MassView.ts (date 1724366892121)
@@ -144,6 +144,9 @@
tandem: Tandem.OPT_OUT
} );
+ // eslint-disable-next-line @typescript-eslint/no-this-alias,consistent-this
+ const selfMassView = this;
+
this.grabDragInteraction = new GrabDragInteraction( this.focusablePath, keyboardDragListener, {
onGrab() {
@@ -153,13 +156,17 @@
mass.interruptedEmitter.addListener( endKeyboardInteraction );
grabSoundPlayer.play();
mass.startDrag( mass.matrix.translation );
+
+ mass.numberOfKeyboardGrabs = selfMassView.grabDragInteraction!.numberOfKeyboardGrabs;
+ mass.numberOfGrabs = selfMassView.grabDragInteraction!.numberOfGrabs;
},
onRelease() {
endKeyboardInteraction();
},
- tandem: Tandem.OPT_OUT
+ tandem: Tandem.OPT_OUT,
+ numberOfKeyboardGrabs: mass.numberOfKeyboardGrabs,
+ numberOfGrabs: mass.numberOfGrabs
} );
-
const myListener = () => {
Index: density-buoyancy-common/js/common/model/Mass.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/density-buoyancy-common/js/common/model/Mass.ts b/density-buoyancy-common/js/common/model/Mass.ts
--- a/density-buoyancy-common/js/common/model/Mass.ts (revision bc64def88a94349258c83284b9f4d88cab6020b2)
+++ b/density-buoyancy-common/js/common/model/Mass.ts (date 1724366467380)
@@ -175,6 +175,13 @@
public readonly resetEmitter = new Emitter();
+ // MassViews and their GrabDragInteractions are recreated, the mass stores relevant information from one instantiation to
+ // another. These quantities do not need to be PhET-iO stateful, because they are related to usability and
+ // accessibility, and when studio launches a Standard PhET-iO Wrapper, these values should be zeroed out, not preserved
+ // in the state
+ public numberOfKeyboardGrabs = 0;
+ public numberOfGrabs = 0;
+
protected constructor( engine: PhysicsEngine, providedOptions: MassOptions ) {
const options = optionize<MassOptions, SelfOptions, PhetioObjectOptions>()( {
@@ -582,6 +589,9 @@
this.resetPosition();
+ this.numberOfGrabs = 0;
+ this.numberOfKeyboardGrabs = 0;
+
this.resetEmitter.emit();
}
Index: scenery-phet/js/accessibility/GrabDragInteraction.ts
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/scenery-phet/js/accessibility/GrabDragInteraction.ts b/scenery-phet/js/accessibility/GrabDragInteraction.ts
--- a/scenery-phet/js/accessibility/GrabDragInteraction.ts (revision 0b0527fc6e01e949fa67392c1cea3c77aca67b39)
+++ b/scenery-phet/js/accessibility/GrabDragInteraction.ts (date 1724367495647)
@@ -145,6 +145,11 @@
// Like keyboardHelpText but when supporting gesture interactive description.
gestureHelpText?: PDOMValueType;
+
+ // When a view is dynamically or lazily created for a persistent model, we may need to indicate that it has previously
+ // been interacted with. Hence you can pass non-zero values to indicate that the view has been interacted with.
+ numberOfGrabs?: number;
+ numberOfKeyboardGrabs?: number;
};
type ParentOptions = EnabledComponentOptions;
@@ -187,11 +192,11 @@
// The number of times the component has been picked up for dragging, regardless
// of pickup method for things like determining content for "hints" describing the interaction
// to the user
- private numberOfGrabs = 0;
+ public numberOfGrabs: number;
// The number of times this component has been picked up with a keyboard specifically to provide hints specific
// to alternative input.
- private numberOfKeyboardGrabs = 0;
+ public numberOfKeyboardGrabs: number;
// The aria-describedby association object that will associate "grabbable" with its
// help text so that it is read automatically when the user finds it. This reference is saved so that
@@ -264,6 +269,9 @@
phetioFeatured: false
},
+ numberOfGrabs: 0,
+ numberOfKeyboardGrabs: 0,
+
// {Tandem} - For instrumenting
tandem: Tandem.REQUIRED
}, providedOptions );
@@ -362,8 +370,8 @@
this.onDraggable = secondPassOptions.onDraggable;
this.addAriaDescribedbyPredicate = secondPassOptions.addAriaDescribedbyPredicate;
this.supportsGestureDescription = secondPassOptions.supportsGestureDescription;
- this.numberOfGrabs = 0;
- this.numberOfKeyboardGrabs = 0;
+ this.numberOfGrabs = secondPassOptions.numberOfGrabs;
+ this.numberOfKeyboardGrabs = secondPassOptions.numberOfKeyboardGrabs;
// set the help text, if provided - it will be associated with aria-describedby when in the "grabbable" state
this.node.descriptionContent = this.supportsGestureDescription ? secondPassOptions.gestureHelpText : secondPassOptions.keyboardHelpText; |
…354 Signed-off-by: Michael Kauzmann <[email protected]>
…hetsims/density-buoyancy-common#354 Signed-off-by: Michael Kauzmann <[email protected]>
@zepumph and I fixed this in the commits. @Nancy-Salpepi can you please test on phettest? |
I can still reproduce on main using the original steps in #354 (comment) 2 other examples:
__
|
Some observations:
|
The problem for the Applications screen is that private bottleView: BottleView | null = null;
private boatView: BoatView | null = null; which nulls it back out. Hence the BottleView and BoatView are created twice. |
Discussed during standup today, and we think this is a good general design question to ask about grab drag interaction. The general question is, "how much does the user need to see the grab cue?"
Let's make a common code issue and ask some experts |
We discussed at a designers meeting with JG SR MK in attendance as well. We noted that it isn't necessarily automatic that cueing grab for a block would translate to cueing grab for the scale. Furthermore, more cueing is better than less cueing, so long as it isn't too distracting or obscuring. We decided to try out the following:
|
This bug will be designed and sorted out over in #368. |
Design has been solidified over in #368. Closing |
Test device
MacBook Air M1 chip
Operating System
14.6.1
Browser
Safari 17.6
Problem description
For phetsims/qa#1136, the ‘space to grab or release’ message resets every time I switch scenes.
From Slack:
Steps to reproduce
Here is an example:
Visuals
messageReappears.mp4
The text was updated successfully, but these errors were encountered: