Skip to content

Commit 027b9d2

Browse files
author
Bianca Marina Stana
committed
Merge branch 'unite2025/lsp-uitk' into unite2025/screen-reader-improvements
2 parents 8d8b0dc + cd8ad8c commit 027b9d2

File tree

7 files changed

+18
-31
lines changed

7 files changed

+18
-31
lines changed

Assets/Scripts/Screen Reader/UGUI/AccessibleElement.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ public event Func<bool> selected
7070
public event Action incremented;
7171
public event Action decremented;
7272

73-
#if UNITY_6000_3_OR_NEWER
7473
event Func<AccessibilityScrollDirection, bool> m_Scrolled;
7574
public event Func<AccessibilityScrollDirection, bool> scrolled
7675
{
@@ -89,7 +88,6 @@ public event Func<AccessibilityScrollDirection, bool> scrolled
8988
}
9089
}
9190
}
92-
#endif // UNITY_6000_3_OR_NEWER
9391

9492
event Func<bool> m_Dismissed;
9593
public event Func<bool> dismissed
@@ -242,12 +240,7 @@ void DisconnectFromSelected()
242240

243241
bool InvokeSelected()
244242
{
245-
var success = m_Selected?.Invoke() ?? false;
246-
247-
node.value = value;
248-
node.state = state;
249-
250-
return success;
243+
return m_Selected?.Invoke() ?? false;
251244
}
252245

253246
void ConnectToIncremented()
@@ -304,12 +297,12 @@ void InvokeDecremented()
304297

305298
void ConnectToScrolled()
306299
{
307-
#if UNITY_6000_3_OR_NEWER
308300
if (node == null || m_Scrolled == null)
309301
{
310302
return;
311303
}
312304

305+
#if UNITY_6000_3_OR_NEWER
313306
node.scrolled -= InvokeScrolled;
314307
node.scrolled += InvokeScrolled;
315308
#endif // UNITY_6000_3_OR_NEWER
@@ -327,12 +320,10 @@ void DisconnectFromScrolled()
327320
#endif // UNITY_6000_3_OR_NEWER
328321
}
329322

330-
#if UNITY_6000_3_OR_NEWER
331323
bool InvokeScrolled(AccessibilityScrollDirection direction)
332324
{
333325
return m_Scrolled?.Invoke(direction) ?? false;
334326
}
335-
#endif // UNITY_6000_3_OR_NEWER
336327

337328
void ConnectToDismissed()
338329
{

Assets/Scripts/Screen Reader/UITk/Handlers/DropdownFieldHandler.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ void CheckForOpenedPopupMenu()
9090
{
9191
var popupAcc = popupMenu.GetOrCreateAccessibleProperties();
9292

93+
#if UNITY_6000_3_OR_NEWER
9394
popupAcc.role = AccessibilityRole.Dropdown;
95+
#endif // UNITY_6000_3_OR_NEWER
9496
popupAcc.active = false;
9597
popupAcc.modal = true;
9698

@@ -116,15 +118,20 @@ void CheckForOpenedPopupMenu()
116118
// NotifyChange();
117119
}
118120

119-
/*var popup = ve.Q("unity-popup");
121+
/*
122+
#if UNITY_6000_3_OR_NEWER
123+
var popup = ve.Q("unity-popup");
124+
120125
if (popup != null && popup.style.display == DisplayStyle.Flex)
121126
{
122127
SetState(AccessibilityState.Expanded);
123128
}
124129
else
125130
{
126131
SetState(AccessibilityState.Collapsed);
127-
}*/
132+
}
133+
#endif // UNITY_6000_3_OR_NEWER
134+
*/
128135
}
129136
}
130137
}

Assets/Scripts/Screen Reader/UITk/Handlers/SliderHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ public void Step(bool incr)
3030
slider.value += step;
3131
}
3232

33+
#if UNITY_2023_3_OR_NEWER
3334
public override AccessibilityRole GetRole() => AccessibilityRole.Slider;
35+
#endif // UNITY_2023_3_OR_NEWER
3436
}
3537
}

Assets/Scripts/Screen Reader/UITk/Handlers/TextFieldHandler.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ public override string GetHint()
4444
return base.GetHint();
4545
}
4646

47-
public override AccessibilityRole GetRole()
48-
{
49-
return AccessibilityRole.TextField;
50-
}
47+
#if UNITY_6000_3_OR_NEWER
48+
public override AccessibilityRole GetRole() => AccessibilityRole.TextField;
49+
#endif // UNITY_6000_3_OR_NEWER
5150
}
5251
}

Assets/Scripts/Screen Reader/UITk/Handlers/VisualElementAccessibilityHandler.cs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,6 @@ public event Func<bool> selected
232232
public event Action incremented;
233233
public event Action decremented;
234234

235-
#if UNITY_6000_3_OR_NEWER
236235
event Func<AccessibilityScrollDirection, bool> m_Scrolled;
237236
public event Func<AccessibilityScrollDirection, bool> scrolled
238237
{
@@ -251,7 +250,6 @@ public event Func<AccessibilityScrollDirection, bool> scrolled
251250
}
252251
}
253252
}
254-
#endif // UNITY_6000_3_OR_NEWER
255253

256254
event Func<bool> m_Dismissed;
257255
public event Func<bool> dismissed
@@ -410,9 +408,6 @@ bool InvokeSelected()
410408

411409
success |= m_Selected?.Invoke() ?? false;
412410

413-
node.value = value;
414-
node.state = state;
415-
416411
return success;
417412
}
418413

@@ -441,9 +436,6 @@ void InvokeIncremented()
441436
{
442437
m_OwnerElement?.GetAccessibleProperties()?.InvokeIncremented();
443438
incremented?.Invoke();
444-
445-
node.value = value;
446-
node.state = state;
447439
}
448440

449441
void ConnectToDecremented()
@@ -471,19 +463,17 @@ void InvokeDecremented()
471463
{
472464
m_OwnerElement?.GetAccessibleProperties()?.InvokeDecremented();
473465
decremented?.Invoke();
474-
475-
node.value = value;
476-
node.state = state;
477466
}
478467

479468
void ConnectToScrolled()
480469
{
481-
#if UNITY_6000_3_OR_NEWER
482470
if (node == null || !m_Scrollable)
483471
{
484472
return;
485473
}
486474

475+
476+
#if UNITY_6000_3_OR_NEWER
487477
node.scrolled -= InvokeScrolled;
488478
node.scrolled += InvokeScrolled;
489479
#endif // UNITY_6000_3_OR_NEWER
@@ -501,7 +491,6 @@ void DisconnectFromScrolled()
501491
#endif // UNITY_6000_3_OR_NEWER
502492
}
503493

504-
#if UNITY_6000_3_OR_NEWER
505494
bool InvokeScrolled(AccessibilityScrollDirection direction)
506495
{
507496
var success = false;
@@ -515,7 +504,6 @@ bool InvokeScrolled(AccessibilityScrollDirection direction)
515504

516505
return success;
517506
}
518-
#endif // UNITY_6000_3_OR_NEWER
519507

520508
void ConnectToDismissed()
521509
{

Assets/UI/Images/Splash-Screen.png

-957 Bytes
Loading
-2.51 KB
Loading

0 commit comments

Comments
 (0)