Skip to content

Commit

Permalink
Add TYPE_VIEW_HOVER_ENTER to AccessibilityNodeInfo sendAccessibilityE…
Browse files Browse the repository at this point in the history
…vent (facebook#34969)

Summary:
- Adds `AccessibilityEvent.TYPE_VIEW_HOVER_ENTER` to AccessibilityNodeInfo sendAccessibilityEvent
- Adds an example implementation.

fixes facebook#30860 fixes facebook#30097
Related Documentation facebook/react-native-website#3438

## Changelog

[Android] [Added] - Add TYPE_VIEW_HOVER_ENTER to AccessibilityNodeInfo sendAccessibilityEvent

Pull Request resolved: facebook#34969

Test Plan:
Android: facebook#34969 (comment) facebook#34969 (comment)
iOS: facebook#34969 (comment) facebook#34969 (comment)

Reviewed By: christophpurrer

Differential Revision: D42613990

Pulled By: lunaleaps

fbshipit-source-id: 8c8950610799dcc74067d2b47b44d4ff030f66e5
  • Loading branch information
fabOnReact authored and OlimpiaZurek committed May 22, 2023
1 parent 43ef54c commit 34168fe
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type AccessibilityAnnouncementFinishedEventHandler = (
event: AccessibilityAnnouncementFinishedEvent,
) => void;

type AccessibilityEventTypes = 'click' | 'focus';
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';

/**
* @see https://reactnative.dev/docs/accessibilityinfo
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type AccessibilityEventDefinitions = {
screenReaderChanged: [boolean],
};

type AccessibilityEventTypes = 'click' | 'focus';
type AccessibilityEventTypes = 'click' | 'focus' | 'viewHoverEnter';

// Mapping of public event names to platform-specific event names.
const EventNames: Map<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,8 @@ public void sendAccessibilityEventFromJS(int surfaceId, int reactTag, String eve
eventType = AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED;
} else if ("click".equals(eventTypeJS)) {
eventType = AccessibilityEvent.TYPE_VIEW_CLICKED;
} else if ("viewHoverEnter".equals(eventTypeJS)) {
eventType = AccessibilityEvent.TYPE_VIEW_HOVER_ENTER;
} else {
throw new IllegalArgumentException(
"sendAccessibilityEventFromJS: invalid eventType " + eventTypeJS);
Expand Down

0 comments on commit 34168fe

Please sign in to comment.