polats Claude Opus 4.5 commited on
Commit
936637d
·
1 Parent(s): 115cffb

fix infinite page expansion on mobile

Browse files

Replace calc(100vh - X) with fixed pixel heights to avoid
iframe expansion loop in HuggingFace Spaces context.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +8 -9
app.py CHANGED
@@ -736,21 +736,20 @@ CUSTOM_CSS = """
736
  button.primary { font-weight: 600; }
737
  .gradio-accordion { margin-bottom: 12px; }
738
 
739
- /* Mobile optimizations */
740
  @media (max-width: 768px) {
741
- /* Constrain the chatbot height on mobile to leave room for input */
742
  #chat-window, .chatbot {
743
- height: calc(100vh - 350px) !important;
744
- min-height: 200px !important;
745
- max-height: calc(100vh - 350px) !important;
746
  }
747
 
748
- /* Hide the TTS audio component label on mobile to save space */
749
  #tts-audio {
750
  margin: 4px 0 !important;
751
  }
752
 
753
- /* Compact the audio player on mobile */
754
  #tts-audio audio {
755
  height: 40px !important;
756
  }
@@ -796,8 +795,8 @@ CUSTOM_CSS = """
796
  /* Extra small screens (phones in portrait) */
797
  @media (max-width: 480px) {
798
  #chat-window, .chatbot {
799
- height: calc(100vh - 380px) !important;
800
- max-height: calc(100vh - 380px) !important;
801
  }
802
 
803
  #input-row {
 
736
  button.primary { font-weight: 600; }
737
  .gradio-accordion { margin-bottom: 12px; }
738
 
739
+ /* Mobile optimizations - use fixed heights to avoid iframe expansion issues */
740
  @media (max-width: 768px) {
741
+ /* Use fixed height for chatbot on mobile (avoids 100vh iframe issues) */
742
  #chat-window, .chatbot {
743
+ height: 350px !important;
744
+ min-height: 250px !important;
745
+ max-height: 350px !important;
746
  }
747
 
748
+ /* Compact the TTS audio on mobile */
749
  #tts-audio {
750
  margin: 4px 0 !important;
751
  }
752
 
 
753
  #tts-audio audio {
754
  height: 40px !important;
755
  }
 
795
  /* Extra small screens (phones in portrait) */
796
  @media (max-width: 480px) {
797
  #chat-window, .chatbot {
798
+ height: 280px !important;
799
+ max-height: 280px !important;
800
  }
801
 
802
  #input-row {