Skip to content

Commit

Permalink
Merge pull request adobe#2422 from adobe/nj/fix-inline-focus
Browse files Browse the repository at this point in the history
Use a more reliable way to determine whether focus is in an inline widget
  • Loading branch information
jasonsanjose committed Dec 20, 2012
2 parents 0660b3d + 2c0165b commit 128851f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/editor/InlineWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,9 @@ define(function (require, exports, module) {

/** @return {boolean} True if any part of the inline widget is focused */
InlineWidget.prototype.hasFocus = function () {
// True if anything in widget's DOM tree has focus (find() excludes root node, hence the extra check)
return this.$htmlContent.find(":focus").length > 0 || this.$htmlContent.is(":focus");
var focusedItem = window.document.activeElement,
htmlContent = this.$htmlContent[0];
return $.contains(htmlContent, focusedItem) || htmlContent === focusedItem;
};

/**
Expand Down

0 comments on commit 128851f

Please sign in to comment.