@@ -224,7 +224,12 @@ public partial class SfTextInputLayout : SfContentView, ITouchListener, IParentT
224
224
/// </summary>
225
225
internal bool IsIconPressed { get ; private set ; } = false ;
226
226
#endif
227
- internal bool IsLayoutTapped { get ; set ; }
227
+
228
+ /// <summary>
229
+ /// Gets or sets a value indicating whether the layout has been tapped.
230
+ /// </summary>
231
+ internal bool IsLayoutTapped { get ; set ; }
232
+
228
233
/// <summary>
229
234
/// Gets or sets a value indicating the hint was animating from down to up.
230
235
/// </summary>
@@ -337,7 +342,9 @@ public partial class SfTextInputLayout : SfContentView, ITouchListener, IParentT
337
342
UIKit . UITextField ? uiEntry ;
338
343
#endif
339
344
340
- #endregion
345
+ private string _initialContentDescription = string . Empty ;
346
+
347
+ #endregion
341
348
342
349
#region Constructor
343
350
@@ -688,8 +695,13 @@ protected override void OnContentChanged(object oldValue, object newValue)
688
695
//Adjusted Opacity from 0 to 0.00001 to ensure the content remains functionally active while enabling the ReturnType property.
689
696
if ( newValue is InputView entryEditorContent )
690
697
{
691
- entryEditorContent . Opacity = IsHintFloated ? 1 : ( DeviceInfo . Platform == DevicePlatform . iOS ? 0.00001 : 0 ) ;
692
- }
698
+ #if ANDROID || IOS
699
+ entryEditorContent . Opacity = IsHintFloated ? 1 : 0.00001 ;
700
+ #else
701
+ entryEditorContent . Opacity = IsHintFloated ? 1 : 0 ;
702
+ #endif
703
+ _initialContentDescription = SemanticProperties . GetDescription ( entryEditorContent ) ;
704
+ }
693
705
else if ( newValue is SfView numericEntryContent && numericEntryContent . Children . Count > 0 )
694
706
{
695
707
if ( numericEntryContent . Children [ 0 ] is Entry numericInputView )
@@ -711,8 +723,63 @@ protected override void OnContentChanged(object oldValue, object newValue)
711
723
{
712
724
OnEnabledPropertyChanged ( IsEnabled ) ;
713
725
}
726
+
727
+ SetCustomDescription ( newValue ) ;
714
728
}
715
729
730
+ /// <summary>
731
+ /// Sets a custom semantic description for the content.
732
+ /// </summary>
733
+ private void SetCustomDescription ( object content )
734
+ {
735
+
736
+ if ( this . Content == null || content == null )
737
+ return ;
738
+
739
+ var customDescription = string . Empty ;
740
+ #if ANDROID || MACCATALYST || IOS
741
+
742
+ if ( content is InputView entryEditorContent )
743
+ {
744
+ customDescription = ( string . IsNullOrEmpty ( entryEditorContent . Text ) && ! string . IsNullOrEmpty ( entryEditorContent . Placeholder ) && DeviceInfo . Platform == DevicePlatform . Android ) ? entryEditorContent . Placeholder : string . Empty ;
745
+ }
746
+
747
+ var layoutDescription = GetLayoutDescription ( ) ;
748
+
749
+ var contentDescription = layoutDescription + ( IsHintFloated ? customDescription + _initialContentDescription : string . Empty ) ;
750
+
751
+ SemanticProperties . SetDescription ( this . Content , contentDescription ) ;
752
+ #elif WINDOWS
753
+
754
+ customDescription = SemanticProperties . GetDescription ( this ) ;
755
+
756
+ if ( string . IsNullOrEmpty ( customDescription ) )
757
+ {
758
+ customDescription = ShowHint && ! string . IsNullOrEmpty ( Hint ) ? Hint : string . Empty ;
759
+ SemanticProperties . SetDescription ( this , customDescription ) ;
760
+ }
761
+ #endif
762
+ }
763
+
764
+ #if ANDROID || MACCATALYST || IOS
765
+ /// <summary>
766
+ /// Retrieves the layout semantic description.
767
+ /// </summary>
768
+ private string GetLayoutDescription ( )
769
+ {
770
+ var description = SemanticProperties . GetDescription ( this ) ;
771
+
772
+ if ( string . IsNullOrEmpty ( description ) )
773
+ {
774
+ description = ShowHint && ! string . IsNullOrEmpty ( Hint ) ? Hint : string . Empty ;
775
+ }
776
+ if ( ! string . IsNullOrEmpty ( description ) )
777
+ {
778
+ description = description . EndsWith ( "." ) ? description : description + ". " ;
779
+ }
780
+ return description ?? string . Empty ;
781
+ }
782
+ #endif
716
783
/// <summary>
717
784
/// Measures the size requirements for the content of the element.
718
785
/// </summary>
0 commit comments