Skip to content

Commit

Permalink
Make activity section header in Community Notifications Settings not …
Browse files Browse the repository at this point in the history
…focusable

Summary:
As part of the Android Accessibility Wave, we want to remove **keyboard focus** for the "Activity" header of the Community Notification Settings

This is because keyboard focus should only focus on relevant screen content. Since the "Activity" heading is considered a "non-interactive" element, we want to remove it from keyboard focus.

This diff:
- Replaces `focusable` with `screenReaderFocusable` for **MigSectionHeader**
- Adds `focusable` to **MigSectionHeaderCTASpec**. That way, the header only gets focusability when it's interactive
- Add new test cases to test that the header is screen reader focusable and is only focusable if it's interactive

Differential Revision: D64793278

fbshipit-source-id: cf6fb3243f8e48ecd3905390ac23aa03e690f6ab
  • Loading branch information
Doris Cheng authored and facebook-github-bot committed Nov 1, 2024
1 parent 3b3b4cc commit a2040d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class DebugLayoutNode internal constructor(private val result: LithoLayoutResult
val focusable: Boolean
get() = node.nodeInfo?.focusState == NodeInfo.FOCUS_SET_TRUE

val screenReaderFocusable: Boolean
get() = node.nodeInfo?.screenReaderFocusState == NodeInfo.SCREEN_READER_FOCUS_SET_TRUE

val contentDescription: CharSequence?
get() = node.nodeInfo?.contentDescription

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,15 @@ public Integer getImportantForAccessibility() {
*/
public boolean getFocusable() {
final DebugLayoutNode layout = mComponent.getLayoutNode();
return layout == null ? false : layout.getFocusable();
return layout != null && layout.getFocusable();
}

/**
* @return The boolean value of the screenReaderFocusable property on this debug component.
*/
public boolean getScreenReaderFocusable() {
final DebugLayoutNode layout = mComponent.getLayoutNode();
return layout != null && layout.getScreenReaderFocusable();
}

/**
Expand Down

0 comments on commit a2040d7

Please sign in to comment.