Auto-dismiss workspace popover when sidebar collapses
Picker pill is only painted in the expanded sidebar, but workspace_picker_open lived independently of sidebar width. If a user opened the picker, then collapsed the sidebar via the toggle or by dragging the resize handle below the COLLAPSED threshold, the popover state stayed `true` — re-expanding the sidebar would surprise them with a stranded popover from before. Drop the picker_open flag inside set_active_sidebar_width whenever the new width is at or below COLLAPSED_SIDEBAR_WIDTH_PX, so the popover state stays in sync with the trigger's visibility.
This commit is contained in:
@@ -130,6 +130,14 @@ impl ElyShell {
|
|||||||
if width_px > HIDDEN_SIDEBAR_WIDTH_PX {
|
if width_px > HIDDEN_SIDEBAR_WIDTH_PX {
|
||||||
self.sidebar_hover_expanded = false;
|
self.sidebar_hover_expanded = false;
|
||||||
}
|
}
|
||||||
|
// Picker pill only shows in the expanded sidebar. If the
|
||||||
|
// sidebar drops below the expanded threshold while the
|
||||||
|
// picker is open, dismiss the popover so its state never
|
||||||
|
// gets stranded waiting for a trigger that's no longer
|
||||||
|
// visible.
|
||||||
|
if width_px <= COLLAPSED_SIDEBAR_WIDTH_PX && self.workspace_picker_open {
|
||||||
|
self.workspace_picker_open = false;
|
||||||
|
}
|
||||||
cx.notify();
|
cx.notify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user