Skip to content

Commit a825095

Browse files
committed
fix(phoenix-tour): expand sidebar before each step
Upgrade flows can boot Phoenix with the sidebar hidden (restored from a previous session), which hides the AI tab (step 2) and the new-project button (step 3) the tour points at. Because both are visibility:hidden rather than display:none, getBoundingClientRect still returns positive dimensions, so the existing rect-zero gate in _trackTarget didn't catch this — the overlay would silently point at invisible UI. Verified the failure mode and the fix in a connected electron instance: the AI tab and new-project button switch from visibility:hidden to visibility:visible after SidebarView.show().
1 parent 023c571 commit a825095

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

src/extensionsIntegrated/Phoenix/phoenix-tour.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ define(function (require, exports, module) {
3232
const Strings = require("strings"),
3333
StringUtils = require("utils/StringUtils"),
3434
Metrics = require("utils/Metrics"),
35+
SidebarView = require("project/SidebarView"),
3536
CentralControlBar = require("view/CentralControlBar");
3637

3738
// Capture the kernel trust ring at module-load time — it's deleted from
@@ -189,7 +190,21 @@ define(function (require, exports, module) {
189190
update();
190191
}
191192

193+
/**
194+
* Make sure the sidebar is showing before each step. Upgrade flows can
195+
* boot Phoenix with the sidebar hidden (the user's last-session state),
196+
* which would hide the AI tab and the new-project button this tour
197+
* points at. Cheap to call when already visible — SidebarView.show()
198+
* is a no-op then.
199+
*/
200+
function _ensureSidebarVisible() {
201+
if (SidebarView && SidebarView.isVisible && !SidebarView.isVisible()) {
202+
SidebarView.show();
203+
}
204+
}
205+
192206
function _runStep1() {
207+
_ensureSidebarVisible();
193208
const $btn = $("#ccbCollapseEditorBtn");
194209
if (!$btn.length) {
195210
_markComplete();
@@ -235,6 +250,7 @@ define(function (require, exports, module) {
235250
}
236251

237252
function _runStep2() {
253+
_ensureSidebarVisible();
238254
const $tab = $('.sidebar-tab[data-tab-id="ai"]');
239255
if (!$tab.length) {
240256
// No AI tab in this build — skip ahead to the next step.
@@ -260,6 +276,7 @@ define(function (require, exports, module) {
260276
}
261277

262278
function _runStep3() {
279+
_ensureSidebarVisible();
263280
const $newBtn = $("#newProject");
264281
if (!$newBtn.length) {
265282
// No new-project button — tour is effectively done.

0 commit comments

Comments
 (0)