Skip to content
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

ToggleNode should use Node.swapVisibility #324

Closed
jessegreenberg opened this issue Oct 24, 2017 · 6 comments
Closed

ToggleNode should use Node.swapVisibility #324

jessegreenberg opened this issue Oct 24, 2017 · 6 comments
Assignees

Comments

@jessegreenberg
Copy link
Contributor

From phetsims/plinko-probability#104, ToggleNode should manage focus for a11y. Node.swapVisibility was added to replace visibility of two Nodes and manage focus, so ToggleNode can make use of this.

@jessegreenberg
Copy link
Contributor Author

@samreid since you are listed as an author would you mind reviewing?

@samreid
Copy link
Member

samreid commented Oct 30, 2017

On hold pending discussion in phetsims/scenery#694 (comment)

@jessegreenberg
Copy link
Contributor Author

Discussion is complete in phetsims/scenery#694, we changed swapVisibility to look like node.swapVisibility( otherNode ). Visibility of node and otherNode cannot be equal, but otherwise there are no restrictions to which node is visible before calling the function. @samreid removing the 'on-hold' label but feel free to wait until final review of phetsims/scenery#694 is complete if you prefer.

@jessegreenberg jessegreenberg removed their assignment Nov 2, 2017
samreid added a commit that referenced this issue Nov 3, 2017
@samreid
Copy link
Member

samreid commented Nov 3, 2017

ToggleNode will need to override dispose to avoid a memory leak because the constructor introduced a new listener to a non-owned Property.

I tested plinko probability with ?accessibility and it appeared that focus transferred properly to the grayed out play button when I pressed all + play.

@jessegreenberg
Copy link
Contributor Author

Thanks @samreid, I added dispose to ToggleNode, and also added ToggleNode to MemoryTestsScreenView to test for ToggleNode leaks. Before adding dispose you can see a climbing JS Heap in between major garbage collections:
capture1

And after dispose was added that goes away:
capture3

@samreid can this be closed?

@samreid
Copy link
Member

samreid commented Nov 3, 2017

Looks great, thanks, closing.

@samreid samreid closed this as completed Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants