From b9ae5d2af6eec3d2952dbc4e60fb9faf28959f52 Mon Sep 17 00:00:00 2001 From: Ian Storm Taylor Date: Wed, 27 Jul 2016 12:52:00 -0700 Subject: [PATCH] fix void node cursor navigation in firefox --- lib/components/void.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/components/void.js b/lib/components/void.js index 43d63ec0e..2dc05bfbd 100644 --- a/lib/components/void.js +++ b/lib/components/void.js @@ -5,6 +5,7 @@ import OffsetKey from '../utils/offset-key' import React from 'react' import ReactDOM from 'react-dom' import keycode from 'keycode' +import { IS_FIREFOX } from '../utils/environment' /** * Void. @@ -109,15 +110,26 @@ class Void extends React.Component { */ renderSpacer = () => { - const style = { - position: 'absolute', - top: '0px', - left: '-9999px', - textIndent: '-9999px' - } + // COMPAT: In Firefox, if the is positioned absolutely, it won't + // receive the cursor properly when navigating via arrow keys. + const style = IS_FIREFOX + ? { + pointerEvents: 'none', + width: '0px', + height: '0px', + lineHeight: '0px', + visibility: 'hidden' + } + : { + pointerEvents: 'none', + position: 'absolute', + top: '0px', + left: '-9999px', + textIndent: '-9999px' + } return ( - {this.renderLeaf()} + {this.renderLeaf()} ) }