Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2024-08-09 - Expanding file drop zones for click events
**Learning:** Tiny file input buttons are hard targets. Expanding the file drop zone containers to trigger the file input on click greatly improves accessibility and usability.
**Action:** When expanding file drop zones to wrap form containers, add a click event listener to programmatically trigger the hidden file input's `.click()` method, while explicitly ignoring clicks on interactive child elements (e.g., `['INPUT', 'BUTTON', 'LABEL'].includes(e.target.tagName)`).

## 2024-07-15 - Dynamic Size formatting and Total Size Validation
**Learning:** Hardcoding human-readable sizes (like '5 GiB') in validation error messages is error-prone when the underlying constant changes. Moreover, failing to validate total upload size against backend limits (e.g., MAX_UPLOAD_BYTES) in batch file uploads frustrates users who wait for a large upload to finish only to get a server-side 413 Payload Too Large error.
**Action:** Always format backend byte limit constants dynamically (e.g., `formatBinaryBytes(MAX_UPLOAD_BYTES)`) on the client side to display accurate error messages. For multiple file inputs, ensure both the file count and the combined file size are validated against backend limits, giving immediate inline feedback via `setCustomValidity` and `aria-invalid`.
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@

### Fixed
- ๋‹จ์ผยท์ผ๊ด„ ๋Œ€์ƒ ํฌ๊ธฐ ์ž…๋ ฅ์„ ๋น„์› ์„ ๋•Œ ์ด์ „ custom validity์™€ `aria-invalid` ์ƒํƒœ๋ฅผ ์ฆ‰์‹œ ์ดˆ๊ธฐํ™”ํ•ด ํ˜„์žฌ ํ•„์ˆ˜ ์ž…๋ ฅ ์ƒํƒœ๋ฅผ ์ •ํ™•ํžˆ ์ „๋‹ฌํ•ฉ๋‹ˆ๋‹ค.

### ๐ŸŽจ Palette: [UX improvement] ํŒŒ์ผ ์—…๋กœ๋“œ ๋“œ๋กญ ์กด ์˜์—ญ ํด๋ฆญ ํƒ€๊ฒŸ ํ™•์žฅ
- ํŒŒ์ผ ์—…๋กœ๋“œ ๋“œ๋กญ ์กด ์˜์—ญ์„ ํด๋ฆญํ•˜์—ฌ ํŒŒ์ผ ์„ ํƒ ์ฐฝ์„ ์—ด ์ˆ˜ ์žˆ๋„๋ก ๊ฐœ์„ ํ•˜์—ฌ ์ ‘๊ทผ์„ฑ๊ณผ ์‚ฌ์šฉ์„ฑ์„ ํ–ฅ์ƒ์‹œ์ผฐ์Šต๋‹ˆ๋‹ค.
12 changes: 12 additions & 0 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,18 @@ async def add_security_headers(request: Request, call_next):
e.preventDefault();
e.stopPropagation();
}
dropZone.addEventListener('click', (e) => {
if (!['INPUT', 'BUTTON', 'LABEL'].includes(e.target.tagName)) {
fileInput.click();
}
});
if (batchDropZone) {
batchDropZone.addEventListener('click', (e) => {
if (!['INPUT', 'BUTTON', 'LABEL'].includes(e.target.tagName)) {
batchFileInput.click();
}
});
}
dropZone.addEventListener('drop', (e) => {
let dt = e.dataTransfer;
let files = dt.files;
Expand Down
3 changes: 3 additions & 0 deletions tests/test_saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ def test_get_ui_includes_preset_buttons(self):
self.assertIn('aria-pressed="false"', html)
self.assertIn('role="group" aria-label="Preset target sizes"', html)
self.assertNotIn('onclick="setTargetBytes(', html)
self.assertIn("dropZone.addEventListener('click'", html)
self.assertIn("batchDropZone.addEventListener('click'", html)
self.assertIn("!['INPUT', 'BUTTON', 'LABEL'].includes(e.target.tagName)", html)
self.assertIn("const presetValue = Number.parseInt(btn.dataset.bytes, 10);", html)
self.assertIn("!e.isTrusted && presetValue === val", html)
self.assertNotIn("btn.dataset.bytes === this.value", html)
Expand Down
Loading