| 2074 | 2074 | let popup; |
| 2075 | 2075 | |
| 2076 | 2076 | const buttonContainer = document.createElement('div'); |
| 2077 | 2077 | buttonContainer.classList.add('flex-container', 'flexFlowColumn', 'wide100p', 'm-t-1'); |
| 2078 | + |
| 2079 | + const scrollableContainer = document.createElement('div'); |
| 2080 | + scrollableContainer.style.maxHeight = '50vh'; // Use viewport height instead of fixed pixels |
| 2081 | + scrollableContainer.style.overflowY = 'auto'; |
| 2082 | + scrollableContainer.style.WebkitOverflowScrolling = 'touch'; // Enable momentum scrolling on iOS |
| 2083 | + scrollableContainer.classList.add('m-t-1', 'scrollable-buttons'); |
| 2084 | + |
| 2085 | + // Add custom CSS for better mobile scrolling |
| 2086 | + const style = document.createElement('style'); |
| 2087 | + style.textContent = ` |
| 2088 | + .scrollable-buttons { |
| 2089 | + -webkit-overflow-scrolling: touch; |
| 2090 | + overflow-y: auto; |
| 2091 | + flex-shrink: 1; |
| 2092 | + min-height: 0; |
| 2093 | + } |
| 2094 | + .scrollable-buttons::-webkit-scrollbar { |
| 2095 | + width: 6px; |
| 2096 | + } |
| 2097 | + .scrollable-buttons::-webkit-scrollbar-thumb { |
| 2098 | + background-color: rgba(0, 0, 0, 0.2); |
| 2099 | + border-radius: 3px; |
| 2100 | + } |
| 2101 | + `; |
| 2102 | + document.head.appendChild(style); |
| 2078 | 2103 | |
| 2079 | 2104 | for (const [result, button] of resultToButtonMap) { |
| 2080 | 2105 | const buttonElement = document.createElement('div'); |