@@ -247,7 +247,9 @@ UITkLetterCard accessibilityFocusedCard
247247 set
248248 {
249249 if ( m_AccessibilityFocusedCard == value )
250+ {
250251 return ;
252+ }
251253
252254 m_AccessibilityFocusedCard ? . Blur ( ) ;
253255
@@ -262,12 +264,14 @@ UITkLetterCard accessibilityFocusedCard
262264 // Note: we don't want to steal the focus if the user is dragging a card.
263265 OnScreenDebug . Log ( "In Acc Focus " + ( m_AccessibilityFocusedCard != null ? m_AccessibilityFocusedCard . name : "null" ) +
264266 " selected " + ( m_LetterCardContainer . selectedCard != null ? m_LetterCardContainer . selectedCard . name : "null" ) ) ;
267+
265268 if ( m_AccessibilityFocusedCard != null && m_LetterCardContainer . selectedCard == null )
269+ {
266270 m_AccessibilityFocusedCard . Focus ( ) ;
271+ }
267272
268273 OnScreenDebug . Log ( "After Acc Focus " + ( m_AccessibilityFocusedCard != null ? m_AccessibilityFocusedCard . name : "null" ) +
269274 " selected " + ( m_LetterCardContainer . selectedCard != null ? m_LetterCardContainer . selectedCard . name : "null" ) ) ;
270-
271275 }
272276 }
273277
@@ -623,6 +627,7 @@ void StateTheLetters()
623627 public void OnWordReorderingCompleted ( )
624628 {
625629 m_LetterCardContainer . canPlayCards = false ;
630+ m_LetterCardContainer . selectedCard . Unselect ( ) ;
626631
627632 m_MainView . schedule . Execute ( _ => AnnounceCorrectWord ( ) ) . ExecuteLater ( 2000 ) ;
628633
@@ -650,18 +655,17 @@ void FadeSuccessImageOut()
650655
651656 void OnNodeFocusChanged ( AccessibilityNode node )
652657 {
653- if ( node ! = null )
658+ if ( node = = null )
654659 {
655- var service = AccessibilityManager . GetService < UITkAccessibilityService > ( ) ;
656- var element = service . GetVisualElementForNode ( m_MainView . panel , node ) ;
657-
658- accessibilityFocusedCard = element as UITkLetterCard ;
659- MoveSelectedCardOnAssistedFocus ( ) ;
660- }
661- else
662- {
663- accessibilityFocusedCard = null ;
660+ return ;
664661 }
662+
663+ var service = AccessibilityManager . GetService < UITkAccessibilityService > ( ) ;
664+ var element = service . GetVisualElementForNode ( m_MainView . panel , node ) ;
665+
666+ accessibilityFocusedCard = element as UITkLetterCard ;
667+
668+ MoveSelectedCardOnAssistedFocus ( ) ;
665669 }
666670
667671 void MoveSelectedCardOnAssistedFocus ( )
@@ -716,28 +720,35 @@ void MoveCard(bool shouldMoveLeft, int count = 1)
716720
717721 // OnScreenDebug.Log("MoveCard " + (shouldMoveLeft ? "left" : "right" + " count " + count));
718722
723+ var updater = m_LetterCardContainer . selectedCard . panel . GetAccessibilityUpdater ( ) ;
724+ var node = updater . GetNodeForVisualElement ( m_LetterCardContainer . selectedCard ) ;
725+
726+ var selectedCardText = m_LetterCardContainer . selectedCard . text ;
727+
728+ var index = m_LetterCardContainer . IndexOf ( m_LetterCardContainer . selectedCard ) ;
729+ var otherCardIndex = shouldMoveLeft ? index - 1 : index + 1 ;
730+ var otherCard = m_LetterCardContainer [ otherCardIndex ] as UITkLetterCard ;
731+ var otherCardText = otherCard ? . text ;
732+
719733 var moved = shouldMoveLeft ?
720734 m_LetterCardContainer . selectedCard . MoveLeft ( count ) :
721735 m_LetterCardContainer . selectedCard . MoveRight ( count ) ;
722736
737+ m_MainView . schedule . Execute ( ( ) =>
738+ AssistiveSupport . notificationDispatcher . SendLayoutChanged ( node )
739+ ) . ExecuteLater ( 50 ) ;
740+
723741 if ( moved )
724742 {
725- var index = m_LetterCardContainer . IndexOf ( m_LetterCardContainer . selectedCard ) ;
726- var otherCardIndex = shouldMoveLeft ? index + 1 : index - 1 ;
727- var otherCard = m_LetterCardContainer [ otherCardIndex ] as UITkLetterCard ;
728-
729743 // TODO: This should be localized.
730- var message = $ "Moved { m_LetterCardContainer . selectedCard . text } { ( shouldMoveLeft ? "before" : "after" ) } { otherCard ? . text } ";
744+ var message = $ "Moved { selectedCardText } { ( shouldMoveLeft ? "before" : "after" ) } { otherCardText } ";
731745
732746 // Announce that the card was moved.
733- AssistiveSupport . notificationDispatcher . SendAnnouncement ( message ) ;
747+ m_MainView . schedule . Execute ( ( ) =>
748+ AssistiveSupport . notificationDispatcher . SendAnnouncement ( message )
749+ ) . ExecuteLater ( 100 ) ;
734750 }
735751
736- var updater = m_LetterCardContainer . selectedCard . panel . GetAccessibilityUpdater ( ) ;
737- var node = updater . GetNodeForVisualElement ( m_LetterCardContainer . selectedCard ) ;
738-
739- AssistiveSupport . notificationDispatcher . SendLayoutChanged ( node ) ;
740-
741752 /*var accElement = draggable.transform.GetComponent<AccessibleElement>();
742753
743754 if (shouldMoveLeft ? draggable.MoveLeft() : draggable.MoveRight())
0 commit comments