Skip to content

Commit 2d34815

Browse files
Merge pull request #201 from Kamalesh-Periyasamy/TextInputLayout-Entry-Accessibility-Issue
Resolved the Tab key navigation issue in TextInputLayout
2 parents 11b87c9 + aef5f54 commit 2d34815

File tree

2 files changed

+36
-29
lines changed

2 files changed

+36
-29
lines changed

maui/src/TextInputLayout/SfTextInputLayout.Properties.cs

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,24 +2193,32 @@ static void OnEnablePasswordTogglePropertyChanged(BindableObject bindable, objec
21932193
}
21942194
}
21952195

2196-
static void OnIsHintFloatedPropertyChanged(BindableObject bindable, object oldValue, object newValue)
2197-
{
2198-
if (bindable is SfTextInputLayout inputLayout && newValue is bool value)
2199-
{
2200-
if (inputLayout.Content is InputView || inputLayout.Content is Microsoft.Maui.Controls.Picker)
2201-
{
2202-
inputLayout.Content.Opacity = value ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
2203-
}
2204-
else if (inputLayout != null && inputLayout.Content is SfView numericEntry && numericEntry.Children.Count > 0)
2205-
{
2206-
if (numericEntry.Children[0] is Entry numericInputView)
2207-
{
2208-
numericInputView.Opacity = value ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
2209-
}
2210-
}
2211-
}
2212-
2213-
}
2196+
static void OnIsHintFloatedPropertyChanged(BindableObject bindable, object oldValue, object newValue)
2197+
{
2198+
if (bindable is SfTextInputLayout inputLayout && newValue is bool value)
2199+
{
2200+
double minOpacity = 0;
2201+
#if ANDROID || IOS
2202+
minOpacity = 0.00001;
2203+
#elif MACCATALYST
2204+
minOpacity = 0.011;
2205+
#endif
2206+
2207+
double targetOpacity = value ? 1 : minOpacity;
2208+
2209+
if (inputLayout.Content is InputView || inputLayout.Content is Microsoft.Maui.Controls.Picker)
2210+
{
2211+
inputLayout.Content.Opacity = targetOpacity;
2212+
}
2213+
else if (inputLayout.Content is SfView numericEntry && numericEntry.Children.Count > 0)
2214+
{
2215+
if (numericEntry.Children[0] is Entry numericInputView)
2216+
{
2217+
numericInputView.Opacity = targetOpacity;
2218+
}
2219+
}
2220+
}
2221+
}
22142222

22152223
static void OnInputViewPaddingPropertyChanged(BindableObject bindable, object oldValue, object newValue)
22162224
{

maui/src/TextInputLayout/SfTextInputLayout.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -843,32 +843,31 @@ protected override void OnContentChanged(object oldValue, object newValue)
843843
UpdateContentMargin(view);
844844
}
845845

846+
double minOpacity = 0;
847+
#if ANDROID || IOS
848+
minOpacity = 0.00001;
849+
#elif MACCATALYST
850+
minOpacity = 0.011;
851+
#endif
852+
846853
//For placeholder overlap issue here handled the opacity value for controls.
847854
if (newValue is InputView entryEditorContent)
848855
{
849-
#if ANDROID || IOS
850-
entryEditorContent.Opacity = IsHintFloated ? 1 : 0.00001;
851-
#else
852-
entryEditorContent.Opacity = IsHintFloated ? 1 : 0;
853-
#endif
856+
entryEditorContent.Opacity = IsHintFloated ? 1 : minOpacity;
854857
_initialContentDescription = SemanticProperties.GetDescription(entryEditorContent);
855858
}
856859
else if (newValue is SfView numericEntryContent && numericEntryContent.Children.Count > 0)
857860
{
858861
if (numericEntryContent.Children[0] is Entry numericInputView)
859862
{
860-
#if ANDROID || IOS
861-
numericInputView.Opacity = IsHintFloated ? 1 : 0.00001;
862-
#else
863-
numericInputView.Opacity = IsHintFloated ? 1 : 0;
864-
#endif
863+
numericInputView.Opacity = IsHintFloated ? 1 : minOpacity;
865864
}
866865
}
867866
else if (newValue is Microsoft.Maui.Controls.Picker picker)
868867
{
869868
if (DeviceInfo.Platform != DevicePlatform.WinUI)
870869
{
871-
picker.Opacity = IsHintFloated ? 1 : (DeviceInfo.Platform == DevicePlatform.iOS ? 0.00001 : 0);
870+
picker.Opacity = IsHintFloated ? 1 : minOpacity;
872871
}
873872
}
874873

0 commit comments

Comments
 (0)