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

Implement Visibility property in ViewHandlers #951

Merged
merged 18 commits into from
May 17, 2021
Merged

Conversation

jsuarezruiz
Copy link
Contributor

Description of Change

Implement Visibility property in ViewHandlers.

  • Collapsed: Do not display the element, and do not reserve space for it in layout.
  • Hidden: Do not display the element, but reserve space for the element in layout.
  • Visible: Display the element.

Related with #707
We need to review which approach fits better.

Platforms Affected

  • Core
  • iOS
  • macOS
  • Android
  • Windows

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Copy link
Member

@mattleibow mattleibow left a comment

Choose a reason for hiding this comment

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

Looks like it is good. Just wondering what is happening with regards to user interaction (hit test and tab stop) as well as accessibility. And then what should happen.

Android seems to have this feature, so does that work differently to when we set alpha to 0?

Comment on lines +25 to +26
nativeView.Opacity = 0;
nativeView.Visibility = UI.Xaml.Visibility.Visible;
Copy link
Member

Choose a reason for hiding this comment

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

How does this work with tab stop, hit testing and screen readers?

Copy link
Contributor

Choose a reason for hiding this comment

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

We don't know yet how they should work, so I think it's moot for now.

Comment on lines 31 to 32
nativeView.Alpha = 0;
nativeView.Hidden = false;
Copy link
Member

Choose a reason for hiding this comment

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

How does this work with hit test and accessibility?

@jsuarezruiz jsuarezruiz merged commit 76d6c03 into main May 17, 2021
@jsuarezruiz jsuarezruiz deleted the visibility-viewhandler branch May 17, 2021 07:36
lytico pushed a commit to lytico/maui that referenced this pull request May 20, 2021
* Implement IsVisible property in ViewHandlers

* Fix the build error

* Fix build error

* Implement Visibility property

* Updated Windows implementation

* Actually trigger an update of the Visibility property with the handlers

* Move bool->Visibility converter into Controls

* Make new layouts Visibility-aware

* Handle Visibility.Collapsed for iOS

* Disambiguate MAUI Visibility and WinUI Visibility

* Set up example

* Fix rebase errors

* Fix rebase errors

* Fix xml comment

* Remove double mapping

* Reconcile ActivityIndicator Visibility with IsRunning property

* Fix iOS Visibility tests

Co-authored-by: E.Z. Hart <hartez@gmail.com>
Co-authored-by: Matthew Leibowitz <mattleibow@live.com>
@greatoceansoftware
Copy link

Did you give up on Visibility (Visible, Hidden, Collapsed) in favor of IsVisible? I can see the enum in the Object Browser, but it's not appearing on any controls yet. I hope I'm misinterpreting this thread incorrectly. Really need Visibility implemented.

@samhouts samhouts added area-controls-collectionview CollectionView, CarouselView, IndicatorView legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-flyoutpage FlyoutPage labels Jul 11, 2023
@samhouts samhouts added area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter area-controls-listview ListView and TableView area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-controls-activityindicator ActivityIndicator area-controls-flyout Flyout area-controls-frame Frame area-controls-slider Slider area-controls-titleview TitleView layout-grid layout-stack platform/android 🤖 platform/iOS 🍎 platform/windows 🪟 labels Jul 11, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
@samhouts samhouts added the fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-activityindicator ActivityIndicator area-controls-collectionview CollectionView, CarouselView, IndicatorView area-controls-flyout Flyout area-controls-flyoutpage FlyoutPage area-controls-frame Frame area-controls-listview ListView and TableView area-controls-shell Shell Navigation, Routes, Tabs, Flyout area-controls-slider Slider area-controls-titleview TitleView area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter fixed-in-6.0.100-preview.5 Look for this fix in 6.0.100-preview.5! layout-grid layout-stack platform/android 🤖 platform/iOS 🍎 platform/windows 🪟
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants