Skip to content

Commit c173f76

Browse files
Refine UX: center lock icon and force scroll to top
Two refinements to improve AI feature UX: 1. Lock Icon Centering (Types.php) - Re-added flexbox with center alignment (justify-content: center) - Positioned near top using align-items: flex-start with 60px padding - Icon is now centered horizontally and positioned at top without text overlap 2. Scroll Position Fix (Types.php + frame.js) - Added inline JavaScript to force scroll to top on page load - Uses both DOMContentLoaded and load events to ensure scroll stays at top - Overrides any cached JavaScript that might cause auto-scroll - Cleaned up frame.js by removing obsolete commented code This ensures the AI image upload section is always visible when opening the chart creation modal, regardless of browser caching. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 5bdad42 commit c173f76

2 files changed

Lines changed: 8 additions & 9 deletions

File tree

classes/Visualizer/Render/Page/Types.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ protected function _renderContent() {
7878

7979
if ( $show_api_lock ) {
8080
// Show API key configuration lock (for PRO users without API keys)
81-
echo '<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.9); border-radius: 8px; z-index: 10; padding-top: 40px;">';
81+
echo '<div style="position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: rgba(255,255,255,0.9); border-radius: 8px; z-index: 10; display: flex; align-items: flex-start; justify-content: center; padding-top: 60px;">';
8282
echo '<div style="text-align: center; padding: 20px;">';
8383
echo '<span class="dashicons dashicons-lock" style="font-size: 48px; color: #999; margin-bottom: 10px; display: block;"></span>';
8484
echo '<h3 style="margin: 10px 0; color: #666;">' . esc_html__( 'AI Features - API Key Required', 'visualizer' ) . '</h3>';
@@ -169,6 +169,12 @@ protected function _renderContent() {
169169
echo '</div>';
170170
}
171171
echo '</div>';
172+
173+
// Ensure the view scrolls to top when loaded (keep AI image upload section visible)
174+
echo '<script type="text/javascript">';
175+
echo 'window.addEventListener("DOMContentLoaded", function() { window.scrollTo(0, 0); });';
176+
echo 'window.addEventListener("load", function() { window.scrollTo(0, 0); });';
177+
echo '</script>';
172178
}
173179

174180
/**

js/frame.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,7 @@
77
/* global vizHaveSettingsChanged */
88

99
(function ($) {
10-
$(window).on('load', function(){
11-
// Removed auto-scroll to chart-select to keep the image upload section visible
12-
// let chart_select = $('#chart-select');
13-
// if(chart_select.length > 0){
14-
// // scroll to the selected chart type.
15-
// $('#chart-select')[0].scrollIntoView();
16-
// }
17-
});
10+
// Auto-scroll removed - scroll position is now managed in Types.php to keep AI image upload visible
1811

1912
$(document).ready(function () {
2013
onReady();

0 commit comments

Comments
 (0)