diff --git a/src/client/core/utils/content-editable.js b/src/client/core/utils/content-editable.js index bb639ead888..cf9c64af693 100644 --- a/src/client/core/utils/content-editable.js +++ b/src/client/core/utils/content-editable.js @@ -1,5 +1,6 @@ import * as domUtils from './dom'; import * as arrayUtils from './array'; +import { isElementVisible } from './position'; //nodes utils @@ -397,6 +398,9 @@ export function calculateNodeAndOffsetByPosition (el, offset) { } } else if (domUtils.isElementNode(target)) { + if (!isElementVisible(target)) + return point; + if (point.offset === 0 && !getContentEditableValue(target).length) { point.node = target; return point; diff --git a/src/client/core/utils/style.js b/src/client/core/utils/style.js index 7e9ca57fa89..5308295903a 100644 --- a/src/client/core/utils/style.js +++ b/src/client/core/utils/style.js @@ -135,22 +135,6 @@ export function hasDimensions (el) { return el && !(el.offsetHeight <= 0 && el.offsetWidth <= 0); } -export function isElementHidden (el) { - //NOTE: it's like jquery ':hidden' selector - if (get(el, 'display') === 'none' || !hasDimensions(el) || el.type && el.type === 'hidden') - return true; - - var elements = domUtils.findDocument(el).querySelectorAll('*'); - var hiddenElements = []; - - for (var i = 0; i < elements.length; i++) { - if (get(elements[i], 'display') === 'none' || !hasDimensions(elements[i])) - hiddenElements.push(elements[i]); - } - - return domUtils.containsElement(hiddenElements, el); -} - export function set (el, style, value) { if (typeof style === 'string') styleUtils.set(el, style, value); diff --git a/test/functional/fixtures/regression/gh-2205/pages/index.html b/test/functional/fixtures/regression/gh-2205/pages/index.html new file mode 100644 index 00000000000..fee2322c6f9 --- /dev/null +++ b/test/functional/fixtures/regression/gh-2205/pages/index.html @@ -0,0 +1,85 @@ + + +
+ +