diff --git a/src/renderers/dom/shared/__tests__/ReactServerRendering-test.js b/src/renderers/dom/shared/__tests__/ReactServerRendering-test.js
index 30d93363b5cb2..47c2ecb430f96 100644
--- a/src/renderers/dom/shared/__tests__/ReactServerRendering-test.js
+++ b/src/renderers/dom/shared/__tests__/ReactServerRendering-test.js
@@ -351,6 +351,21 @@ describe('ReactDOMServer', () => {
expect(numClicks).toEqual(2);
});
+ // We have a polyfill for autoFocus on the client, but we intentionally don't
+ // want it to call focus() when hydrating because this can mess up existing
+ // focus before the JS has loaded.
+ it('should emit autofocus on the server but not focus() when hydrating', () => {
+ var element = document.createElement('div');
+ element.innerHTML = ReactDOMServer.renderToString(
+ ,
+ );
+ expect(element.firstChild.autofocus).toBe(true);
+
+ element.firstChild.focus = jest.fn();
+ ReactDOM.hydrate(, element);
+ expect(element.firstChild.focus).not.toHaveBeenCalled();
+ });
+
it('should throw with silly args', () => {
expect(
ReactDOMServer.renderToString.bind(ReactDOMServer, {x: 123}),