-
Notifications
You must be signed in to change notification settings - Fork 12
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
Dialog should have an option to put the close button last in the pdomOrder #724
Comments
@jessegreenberg and I like I also noticed that the current PDOM order can leak a |
@jessegreenberg please review this. I added assertions because I had to do some hackary to come up with a good default focusOnShowNode when the close button is last. |
// pdom - focus the CloseButton when the Dialog is open, unless another focusOnShowNode is provided
options.focusOnShowNode = options.focusOnShowNode || pdomOrder[ 0 ];
assert && assert( options.focusOnShowNode instanceof Node, 'should be non-null and defined' );
assert && assert( options.focusOnShowNode.focusable,
'focusOnShowNode. This may mean that the first item in pdomOrder is not focusable. In this case please adjust ' +
'closeButtonLastInPDOM or provide a custom focusOnShowNode.' ); This seems a bit too strict to me. Are we sure that we never want the close button last if the Dialog has no interactive content? What about if the content Node does have focusable content but it is not focusable itself? The close button still seems like a reasonable default. Otherwise, the option looks good! |
How would you recommend this then? I don't know how to choose a focusOnShowNode if the closeButton is last and there is no interactive content. What get's focused? Should I just go through the entire PDOMOrder and pick the first focusable item? |
No, I would recommend just focusing the |
Hows that? Tested with: Index: js/AboutDialog.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/js/AboutDialog.js b/js/AboutDialog.js
--- a/js/AboutDialog.js (revision cd9dc495092421afbbf827ff0c9dbf5888fa09ec)
+++ b/js/AboutDialog.js (date 1634251723326)
@@ -45,6 +45,7 @@
xSpacing: 26,
topMargin: 26,
bottomMargin: 26,
+ closeButtonLastInPDOM: true,
leftMargin: 26,
rightMargin: 26,
phetioReadOnly: true, // the AboutDialog should not be settable
|
I think thats great, thanks! |
While discussing phetsims/joist#750 in design meeting, we thought that some dialogs would seem better to have the close button last. It seems like a good use case to support, and we likely will for in the vegas reward dialog (over in phetsims/vegas#96).
Tagging @jessegreenberg because he is a boss, but I'll take the lead first.
The text was updated successfully, but these errors were encountered: