Skip to content

Conversation

@agniuks
Copy link
Contributor

@agniuks agniuks commented Mar 12, 2021

As mentioned in #6355, components with display:none still participate in focus and UIA. This adds new logic in FrameworkElementViewManager to change visbility to collapsed when display: is set to none.

I tested the behavior through a new example in RNTester View component page using TextInput to confirm that focus is disabled when display:none.

Fixes #6355, also likely fixes react-navigation #9109.

Microsoft Reviewers: Open in CodeFlow

@agniuks agniuks requested a review from a team March 12, 2021 18:34
@agniuks
Copy link
Contributor Author

agniuks commented Mar 12, 2021

Question: from this snapshot and inspecting component properties from VS, it seems like the visibility remains as "visibile," despite the behavior changing as if it was collapsing(and from setting breakpoints in FrameworkElementViewManager I can see that the right code is getting hit and the Visibility value gets set to "Collapsed" - but I never see this in XAML) - any idea what's going on?

@agniuks agniuks changed the title Displaynonefix Fix XAML Visibility for display:none Mar 12, 2021
@ghost ghost added the Area: Layout label Mar 12, 2021
@asklar
Copy link
Member

asklar commented Mar 12, 2021

Question: from this snapshot and inspecting component properties from VS, it seems like the visibility remains as "visibile," despite the behavior changing as if it was collapsing(and from setting breakpoints in FrameworkElementViewManager I can see that the right code is getting hit and the Visibility value gets set to "Collapsed" - but I never see this in XAML) - any idea what's going on?

if the tree dump says it's not collapsed then it's probably not collapsed : ) (and something else may be re-setting the property?)
Do you see the collapsed element in the UI? What does the Live Visual Tree and Property panes say?

@agniuks
Copy link
Contributor Author

agniuks commented Mar 12, 2021

Question: from this snapshot and inspecting component properties from VS, it seems like the visibility remains as "visibile," despite the behavior changing as if it was collapsing(and from setting breakpoints in FrameworkElementViewManager I can see that the right code is getting hit and the Visibility value gets set to "Collapsed" - but I never see this in XAML) - any idea what's going on?

if the tree dump says it's not collapsed then it's probably not collapsed : ) (and something else may be re-setting the property?)
Do you see the collapsed element in the UI? What does the Live Visual Tree and Property panes say?

The "collapsed" element is no longer seen in the UI, but the Live Visual Tree and accompanying properties do not seem to change when display:none is toggled. If I undo the code change I added, same thing happens - component goes out of view when display is set to none, but you are still able to tab into those components - when I add the change back in, I'm no longer able to tab into components which are set to display:none, but according to the properties the visibility is still "visible"...

@rectified95
Copy link
Contributor

Overall looks good. Just make sure you figure out the xaml dump issue

@rectified95
Copy link
Contributor

Also, the JS checks are failing. You need to run yarn lint:fix - it'll resolve formatting issues. Also run yarn flow-check (with/without '-', dont remember)

@agniuks
Copy link
Contributor Author

agniuks commented Mar 12, 2021

Also, the JS checks are failing. You need to run yarn lint:fix - it'll resolve formatting issues. Also run yarn flow-check (with/without '-', dont remember)

Will do, I ran yarn lint:fix but missed the latter.

@rectified95
Copy link
Contributor

rectified95 commented Mar 12, 2021

I've looked in the CI logs, and there are excessive white spaces - you must have run lint:fix earlier but it didn't get committed.

@asklar
Copy link
Member

asklar commented Mar 16, 2021

@AgneLukoseviciute looks like the test was removed, was that intentional?

@agniuks
Copy link
Contributor Author

agniuks commented Mar 16, 2021

@AgneLukoseviciute looks like the test was removed, was that intentional?

Yep, I filed an issue(#7392) that will need to get fixed before I could get the tests working. The way the tests search in the e2e app isn't filtering the results down enough, at least in the case of View.

@agniuks agniuks requested review from asklar and rectified95 March 16, 2021 14:23
@asklar
Copy link
Member

asklar commented Mar 16, 2021

Thanks @AgneLukoseviciute ; in the meantime, can we add the test to a different/new page instead?

@agniuks
Copy link
Contributor Author

agniuks commented Mar 16, 2021

Thanks @AgneLukoseviciute ; in the meantime, can we add the test to a different/new page instead?

Yep that should work - I'll add it.

@asklar
Copy link
Member

asklar commented Mar 19, 2021

@AgneLukoseviciute Looks like your snapshots are missing the Left/Top attached properties which the tests recently started requiring. Can you rebase your changes onto the latest master and re-generate the snapshot?

Copy link
Contributor

@rectified95 rectified95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to remove the duplicate file

@ghost ghost added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Mar 19, 2021
@agniuks
Copy link
Contributor Author

agniuks commented Apr 14, 2021

Question: from this snapshot and inspecting component properties from VS, it seems like the visibility remains as "visibile," despite the behavior changing as if it was collapsing(and from setting breakpoints in FrameworkElementViewManager I can see that the right code is getting hit and the Visibility value gets set to "Collapsed" - but I never see this in XAML) - any idea what's going on?

if the tree dump says it's not collapsed then it's probably not collapsed : ) (and something else may be re-setting the property?)
Do you see the collapsed element in the UI? What does the Live Visual Tree and Property panes say?

The "collapsed" element is no longer seen in the UI, but the Live Visual Tree and accompanying properties do not seem to change when display:none is toggled. If I undo the code change I added, same thing happens - component goes out of view when display is set to none, but you are still able to tab into those components - when I add the change back in, I'm no longer able to tab into components which are set to display:none, but according to the properties the visibility is still "visible"...

Final comment before merging: Confirmed the elements are getting collapsed through Live Visual Tree and Property panes however the snapshot tests do not reflect this. Might require filing an issue - and if/when this gets fixed this test will fail and will just need updated snapshots to go through.

Additionally, I had to hard code the width for the view containing 2 Text and 2 Switch components as there was a weird width mismatch from running locally vs in the CI checks. To confirm the display:none property change was not the cause, I made sure update property for display was not getting hit when the prop was not used and commit a2ea3df confirmed the view width issue persists even when display:none is not used.

@agniuks agniuks merged commit 8a0d144 into microsoft:master Apr 14, 2021
@asklar
Copy link
Member

asklar commented Apr 14, 2021

Question: from this snapshot and inspecting component properties from VS, it seems like the visibility remains as "visibile," despite the behavior changing as if it was collapsing(and from setting breakpoints in FrameworkElementViewManager I can see that the right code is getting hit and the Visibility value gets set to "Collapsed" - but I never see this in XAML) - any idea what's going on?

if the tree dump says it's not collapsed then it's probably not collapsed : ) (and something else may be re-setting the property?)
Do you see the collapsed element in the UI? What does the Live Visual Tree and Property panes say?

The "collapsed" element is no longer seen in the UI, but the Live Visual Tree and accompanying properties do not seem to change when display:none is toggled. If I undo the code change I added, same thing happens - component goes out of view when display is set to none, but you are still able to tab into those components - when I add the change back in, I'm no longer able to tab into components which are set to display:none, but according to the properties the visibility is still "visible"...

Final comment before merging: Confirmed the elements are getting collapsed through Live Visual Tree and Property panes however the snapshot tests do not reflect this. Might require filing an issue - and if/when this gets fixed this test will fail and will just need updated snapshots to go through.

Additionally, I had to hard code the width for the view containing 2 Text and 2 Switch components as there was a weird width mismatch from running locally vs in the CI checks. To confirm the display:none property change was not the cause, I made sure update property for display was not getting hit when the prop was not used and commit a2ea3df confirmed the view width issue persists even when display:none is not used.

@AgneLukoseviciute: filed #7586

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Components under "display: none" still participate in focus, UIA, etc

4 participants