File tree Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Expand file tree Collapse file tree 2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 11# 2.33.1-0 / Unreleased
2+ * tree.hasFocus() more reliable.
23
34# 2.33.0 / 2019-10-29
45 * [ Added] event ` preInit ` (fired before nodes are loaded).
Original file line number Diff line number Diff line change 34373437 * @returns {boolean }
34383438 */
34393439 hasFocus : function ( ) {
3440- return ! ! this . _hasFocus ;
3440+ var ae = document . activeElement ,
3441+ hasFocus = ! ! (
3442+ ae && $ ( ae ) . closest ( ".fancytree-container" ) . length
3443+ ) ;
3444+
3445+ if ( hasFocus !== ! ! this . _hasFocus ) {
3446+ this . warn (
3447+ "hasFocus(): fix inconsistent container state, now: " +
3448+ hasFocus
3449+ ) ;
3450+ this . _hasFocus = hasFocus ;
3451+ this . $container . toggleClass ( "fancytree-treefocus" , hasFocus ) ;
3452+ }
3453+ return hasFocus ;
3454+ // return !!this._hasFocus;
34413455 } ,
34423456 /** Write to browser console if debugLevel >= 3 (prepending tree name)
34433457 * @param {* } msg string or object or array of such
You can’t perform that action at this time.
0 commit comments