#2742·c3

[Violation] 'focus' handler took XXX ms

Author: visethCreated Jan 24, 2020Updated Aug 19, 2025
  • C3 version: v0.7.12
  • D3 version: v5.15
  • Browser: Chrome 79.0.3945.130 (Build officiel) (64 bits)
  • OS: Windows 10 (64 bits)

Hi, Thanks for this amazing lib !

The console log of Chrome is cluttered with verbose message of this type: [Violation] 'focus' handler took 519ms c3.js:2311 Which makes the navigation on the page very bad. The clicks responsiveness is totally bad at some point.

Here's a little JSFiddle
https://jsfiddle.net/Viseth7/ad19b7s6/8/

  1. open the console.log
  2. click on the icon at the top left corner
  3. move the subchart aera back and forth and navigate to another tab of your browser

=> message log verbose appear and the navigation experience goes bad.

All messages point to the same line of code " this.windowFocusHandler = function ()" :

` ChartInternal.prototype.bindWindowFocus = function () { var _this = this;

if (this.windowFocusHandler) {
  // The handler is already set
  return;
}

this.windowFocusHandler = function () {
  _this.redraw();
};

//window.addEventListener('focus', this.windowFocusHandler)
//custom
window.addEventListener('focus', this.windowFocusHandler, { capture: true, passive: true });

}; `

Please below is the console log screeshot.

image

I don't know whether this has to do with uikit-3.2.7 that I used in this project.

Does anyone else experience the same ? Any hints and idea ?