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 (#34969)

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

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

## Changelog

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

Pull Request resolved: #34969

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

Reviewed By: christophpurrer

Differential Revision: D42613990

Pulled By: lunaleaps

fbshipit-source-id: 8c8950610799dcc74067d2b47b44d4ff030f66e5
  • Loading branch information
fabOnReact authored and facebook-github-bot committed Mar 1, 2023
1 parent 22ba1e4 commit a0adf57
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 a0adf57

Please sign in to comment.