Skip to content

Commit 4842fbe

Browse files
authored
[react-dom] Add support for onFullscreenChange and onFullscreenError events (facebook#34621)
1 parent 61db53c commit 4842fbe

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

packages/react-dom-bindings/src/events/DOMEventNames.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export type DOMEventName =
5151
| 'focusin'
5252
| 'focusout'
5353
| 'fullscreenchange'
54+
| 'fullscreenerror'
5455
| 'gotpointercapture'
5556
| 'hashchange'
5657
| 'input'

packages/react-dom-bindings/src/events/DOMEventProperties.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ const simpleEventPluginEvents = [
6262
'encrypted',
6363
'ended',
6464
'error',
65+
'fullscreenChange',
66+
'fullscreenError',
6567
'gotPointerCapture',
6668
'input',
6769
'invalid',

packages/react-dom-bindings/src/events/ReactDOMEventListener.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ export function getEventPriority(domEventName: DOMEventName): EventPriority {
362362
case 'beforeinput':
363363
case 'blur':
364364
case 'fullscreenchange':
365+
case 'fullscreenerror':
365366
case 'focus':
366367
case 'hashchange':
367368
case 'popstate':

packages/react-dom/src/__tests__/ReactDOMEventPropagation-test.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,40 @@ describe('ReactDOMEventListener', () => {
834834
},
835835
});
836836
});
837+
838+
it('onFullscreenChange', async () => {
839+
await testNativeBubblingEvent({
840+
type: 'div',
841+
reactEvent: 'onFullscreenChange',
842+
reactEventType: 'fullscreenchange',
843+
nativeEvent: 'fullscreenchange',
844+
dispatch(node) {
845+
node.dispatchEvent(
846+
new Event('fullscreenchange', {
847+
bubbles: true,
848+
cancelable: false,
849+
}),
850+
);
851+
},
852+
});
853+
});
854+
855+
it('onFullscreenError', async () => {
856+
await testNativeBubblingEvent({
857+
type: 'div',
858+
reactEvent: 'onFullscreenError',
859+
reactEventType: 'fullscreenerror',
860+
nativeEvent: 'fullscreenerror',
861+
dispatch(node) {
862+
node.dispatchEvent(
863+
new Event('fullscreenerror', {
864+
bubbles: true,
865+
cancelable: false,
866+
}),
867+
);
868+
},
869+
});
870+
});
837871
});
838872

839873
describe('non-bubbling events that bubble in React', () => {

0 commit comments

Comments
 (0)