Skip to content

Commit e8f0ec5

Browse files
christian-byrneviva-jinyiclaude
authored
[fix] Correct WhatsNew popup arrow alignment with help center icon (#5137)
* [fix] Correct WhatsNew popup arrow alignment with help center icon The arrow positioning was not accounting for additional sidebar icons (terminal and shortcuts) that were added below the help center icon, causing misalignment. Updated the calculation to properly position the arrow relative to the help center icon's current location. Fixes #5126 * [fix] Update small sidebar arrow positioning and improve center alignment - Fixed small sidebar rule to use consistent calculation with normal sidebar - Updated positioning to use half icon height for better center alignment - Both normal and small sidebar now use dynamic CSS variable calculations Addresses feedback from review by viva-jinyi on CSS specificity and positioning accuracy. * [fix] Make sidebar CSS variables global for teleported components - Move --sidebar-width CSS variable to :root to make it accessible globally - This allows teleported components like WhatsNewPopup to reference sidebar dimensions - Adjust arrow positioning calculations for better alignment with help center icon - Add explanatory comments about why these variables need to be global 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: icon-size should be variable --------- Co-authored-by: Jin Yi <[email protected]> Co-authored-by: Claude <[email protected]>
1 parent 1b83d6b commit e8f0ec5

File tree

2 files changed

+25
-9
lines changed

2 files changed

+25
-9
lines changed

src/components/helpcenter/WhatsNewPopup.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,6 @@ const closePopup = async () => {
136136
hide()
137137
}
138138
139-
// Learn more handled by anchor href
140-
141139
// const handleCTA = async () => {
142140
// window.open('https://docs.comfy.org/installation/update_comfyui', '_blank')
143141
// await closePopup()
@@ -161,8 +159,10 @@ defineExpose({
161159
<style scoped>
162160
/* Popup container - positioning handled by parent */
163161
.whats-new-popup-container {
162+
--whats-new-popup-bottom: 1rem;
163+
164164
position: absolute;
165-
bottom: 1rem;
165+
bottom: var(--whats-new-popup-bottom);
166166
z-index: 1000;
167167
pointer-events: auto;
168168
}
@@ -171,8 +171,8 @@ defineExpose({
171171
.help-center-arrow {
172172
position: absolute;
173173
bottom: calc(
174-
var(--sidebar-width, 4rem) + 0.25rem
175-
); /* Position toward center of help center icon */
174+
var(--sidebar-width) * 2 + var(--sidebar-width) / 2
175+
); /* Position to center of help center icon (2 icons below + half icon height for center) */
176176
transform: none;
177177
z-index: 999;
178178
pointer-events: none;
@@ -185,7 +185,10 @@ defineExpose({
185185
186186
.whats-new-popup-container.sidebar-left.small-sidebar .help-center-arrow {
187187
left: -14px; /* Overlap with popup outline */
188-
bottom: calc(2.5rem + 0.25rem); /* Adjust for small sidebar */
188+
bottom: calc(
189+
var(--sidebar-width) * 2 + var(--sidebar-icon-size) / 2 -
190+
var(--whats-new-popup-bottom)
191+
); /* Position to center of help center icon (2 icons below + half icon height for center - whats new popup bottom position ) */
189192
}
190193
191194
/* Sidebar positioning classes applied by parent */

src/components/sidebar/SideToolbar.vue

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,22 @@ const getTabTooltipSuffix = (tab: SidebarTabExtension) => {
7676
}
7777
</script>
7878

79+
<style>
80+
/* Global CSS variables for sidebar
81+
* These variables need to be global (not scoped) because they are used by
82+
* teleported components like WhatsNewPopup that render outside the sidebar
83+
* but need to reference sidebar dimensions for proper positioning.
84+
*/
85+
:root {
86+
--sidebar-width: 4rem;
87+
--sidebar-icon-size: 1rem;
88+
}
89+
90+
:root:has(.side-tool-bar-container.small-sidebar) {
91+
--sidebar-width: 2.5rem;
92+
}
93+
</style>
94+
7995
<style scoped>
8096
.side-tool-bar-container {
8197
display: flex;
@@ -88,9 +104,6 @@ const getTabTooltipSuffix = (tab: SidebarTabExtension) => {
88104
background-color: var(--comfy-menu-secondary-bg);
89105
color: var(--fg-color);
90106
box-shadow: var(--bar-shadow);
91-
92-
--sidebar-width: 4rem;
93-
--sidebar-icon-size: 1rem;
94107
}
95108
96109
.side-tool-bar-container.small-sidebar {

0 commit comments

Comments
 (0)