{"record":{"id":"13734dd45d254899","repo":"greensock/GSAP","slug":"gsdevtools-warning-only-one-instance-can-be-affe","errorCode":null,"errorMessage":"[GSDevTools warning] only one instance can be affected by keyboard shortcuts. There is already one active.","messagePattern":"\\[GSDevTools warning\\] only one instance can be affected by keyboard shortcuts\\. There is already one active\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/GSDevTools.js","lineNumber":1029,"sourceCode":"\t\t_addListener(playPauseButton, \"mousedown\", togglePlayPause);\n\t\t_addListener(find(\".seek-bar\"), \"mousedown\", onPressSeekBar);\n\t\t_addListener(find(\".rewind\"), \"mousedown\", onPressRewind);\n\t\t_addListener(loopButton, \"mousedown\", toggleLoop);\n\t\t_addListener(timeScale, \"change\", onChangeTimeScale);\n\n\t\tif (vars.visibility === \"auto\") {\n\t\t\t_addListener(root, \"mouseout\", onMouseOut);\n\t\t\t//_addListener(find(\".gs-hit-area\"), \"mouseover\", show);\n\t\t\t_addListener(root, \"mouseover\", show);\n\n\t\t} else if (vars.visibility === \"hidden\") {\n\t\t\thidden = true;\n\t\t\tautoHideTween.progress(1);\n\t\t}\n\n\t\tif (vars.keyboard !== false) {\n\t\t\tif (_keyboardInstance && vars.keyboard) {\n\t\t\t\tconsole.warn(\"[GSDevTools warning] only one instance can be affected by keyboard shortcuts. There is already one active.\");\n\t\t\t} else {\n\t\t\t\t_keyboardInstance = _self; //we can't have multiple instances all affected by the keyboard.\n\t\t\t\tkeyboardHandler = e => { //window.parent allows things to work inside of an iframe, like on codepen.\n\t\t\t\t\tlet key = e.keyCode ? e.keyCode : e.which,\n\t\t\t\t\t\tts;\n\t\t\t\t\tif (key === 32) { //spacebar\n\t\t\t\t\t\ttogglePlayPause();\n\t\t\t\t\t} else if (key === 38) { //up arrow\n\t\t\t\t\t\tts = parseFloat(_shiftSelectedValue(timeScale, -1, timeScaleLabel));\n\t\t\t\t\t\tlinkedAnimation.timeScale(ts);\n\t\t\t\t\t\trecord(\"timeScale\", ts);\n\t\t\t\t\t} else if (key === 40) { //down arrow\n\t\t\t\t\t\tts = parseFloat(_shiftSelectedValue(timeScale, 1, timeScaleLabel));\n\t\t\t\t\t\tlinkedAnimation.timeScale(ts);\n\t\t\t\t\t\trecord(\"timeScale\", ts);\n\t\t\t\t\t} else if (key === 37) { //left arrow\n\t\t\t\t\t\tonPressRewind(e);\n\t\t\t\t\t} else if (key === 39) { //right arrow","sourceCodeStart":1011,"sourceCodeEnd":1047,"githubUrl":"https://github.com/greensock/GSAP/blob/13e2b790546426a1a2e0e9b409f3f8dc6d6611f2/src/GSDevTools.js#L1011-L1047","documentation":"Keyboard shortcuts (spacebar, arrows) are wired globally to one GSDevTools instance at a time. If a second instance enables keyboard while one already holds _keyboardInstance, GSDevTools warns that only one instance can respond to the keyboard.","triggerScenarios":"Creating two GSDevTools instances with vars.keyboard !== false (or explicitly true) without killing or disabling the first; the default (keyboard enabled) makes two plain instances collide.","commonSituations":"Multiple dev tool panels on one page during debugging; component-based apps instantiating a tool per component; forgetting keyboard defaults to on.","solutions":["Set keyboard:false on all but one instance","Kill the previous instance's keyboard ownership by killing that instance","Ensure only one GSDevTools instance exists at a time"],"exampleFix":"// before\nGSDevTools.create({ animation: tl1 });\nGSDevTools.create({ animation: tl2 }); // second warns\n// after\nGSDevTools.create({ animation: tl1 });\nGSDevTools.create({ animation: tl2, keyboard: false });","handlingStrategy":"validation","validationCode":"if (!document.querySelector('.gs-dev-tools')) { GSDevTools.create({ animation, keyboard: true }); } else { GSDevTools.create({ animation, keyboard: false }); }","typeGuard":"const keyboardIsFree = () => !GSDevTools.getByAnimation(gsap.globalTimeline) || true; // track your instances in app state instead","tryCatchPattern":null,"preventionTips":["Enable keyboard on exactly one instance","Remember keyboard defaults to enabled — set keyboard:false on extra instances","Track created instances in app state and reuse instead of recreating"],"tags":["gsap","keyboard","singleton"],"backgroundTag":"singleton-instance-conflict","analyzedSha":"13e2b790546426a1a2e0e9b409f3f8dc6d6611f2","analyzedAt":"2026-08-29T08:34:05.027Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}