@@ -325,7 +325,6 @@ export class View extends ViewCommon {
325
325
326
326
public _dialogFragment : androidx . fragment . app . DialogFragment ;
327
327
public _manager : androidx . fragment . app . FragmentManager ;
328
- private _isFocusableByDefault : boolean = false ;
329
328
private touchListenerIsSet : boolean ;
330
329
private touchListener : android . view . View . OnTouchListener ;
331
330
private layoutChangeListenerIsSet : boolean ;
@@ -471,14 +470,6 @@ export class View extends ViewCommon {
471
470
}
472
471
}
473
472
474
- public afterInitNativeView ( ) : void {
475
- super . afterInitNativeView ( ) ;
476
-
477
- // Setting this during initNativeView would result in skipping the right focusable state on views
478
- // like ListView which becomes focusable in initNativeView scope
479
- this . _isFocusableByDefault = this . nativeViewProtected . isFocusable ( ) ;
480
- }
481
-
482
473
public needsOnLayoutChangeListener ( ) {
483
474
return this . hasListeners ( ViewCommon . layoutChangedEvent ) ;
484
475
}
@@ -833,14 +824,13 @@ export class View extends ViewCommon {
833
824
}
834
825
835
826
[ accessibilityEnabledProperty . setNative ] ( value : boolean ) : void {
827
+ // Even though this property can be true on initialization, views like layouts can be non-focusable
828
+ const isUserInteractionEnabled = this . isUserInteractionEnabled && this . nativeViewProtected . isFocusable ( ) ;
829
+
830
+ // ensure `accessibilityEnabled=false` does not disable focus for view with `isUserInteractionEnabled=true`
831
+ this . nativeViewProtected . setFocusable ( ! ! value || isUserInteractionEnabled ) ;
836
832
if ( value ) {
837
- this . nativeViewProtected . setFocusable ( true ) ;
838
833
updateAccessibilityProperties ( this ) ;
839
- } else {
840
- // Mark as non-focusable only if view is supposed to be so by default
841
- if ( ! this . _isFocusableByDefault ) {
842
- this . nativeViewProtected . setFocusable ( false ) ;
843
- }
844
834
}
845
835
}
846
836
0 commit comments