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
6 changes: 6 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,9 @@
## 2024-07-13 - 일괄 μ—…λ‘œλ“œ 폼에 프리셋 λ²„νŠΌ 및 파일 크기 미리보기 μΆ”κ°€
**Learning:** 일괄 파일 μ—…λ‘œλ“œ νΌμ—μ„œ λŒ€μƒ λ°”μ΄νŠΈ(target_bytes) μž…λ ₯ ν•„λ“œλ§Œ μ œκ³΅ν•˜λ©΄ μ‚¬μš©μžκ°€ μ›ν•˜λŠ” μš©λŸ‰μ„ λ°”μ΄νŠΈ λ‹¨μœ„λ‘œ μ •ν™•νžˆ κ³„μ‚°ν•˜κΈ° μ–΄λ €μ›Œ μ‚¬μš©μ„±μ΄ λ–¨μ–΄μ§‘λ‹ˆλ‹€. μ‚¬μš©μžκ°€ μ—¬λŸ¬ νŒŒμΌμ„ μ—…λ‘œλ“œν•  λ•Œ 총 파일 크기λ₯Ό νŒŒμ•…ν•˜μ§€ λͺ»ν•΄ μ—…λ‘œλ“œ μ œν•œμ„ μ΄ˆκ³Όν•˜κ±°λ‚˜ 잘λͺ»λœ λŒ€μƒ λ°”μ΄νŠΈλ₯Ό μ„€μ •ν•  μœ„ν—˜μ΄ ν½λ‹ˆλ‹€.
**Action:** 일괄 파일 μ—…λ‘œλ“œ 폼에도 단일 파일 μ—…λ‘œλ“œ 폼과 λ™μΌν•˜κ²Œ λŒ€μƒ λ°”μ΄νŠΈλ₯Ό μ‰½κ²Œ 선택할 수 μžˆλŠ” λΉ λ₯Έ 프리셋 λ²„νŠΌμ„ μΆ”κ°€ν•˜κ³ , `onchange` 이벀트 λ°œμƒ μ‹œ μ„ νƒλœ λͺ¨λ“  파일의 크기λ₯Ό ν•©μ‚°ν•˜μ—¬ μ‚¬λžŒμ΄ 읽기 μ‰¬μš΄ λ‹¨μœ„(MiB, GiB λ“±)둜 미리보기λ₯Ό μ œκ³΅ν•˜λ„λ‘ JavaScript λ‘œμ§μ„ κ°œμ„ ν–ˆμŠ΅λ‹ˆλ‹€.
## 2024-07-20 - Inline Validation for Empty Numeric Inputs
**Learning:** When implementing JavaScript inline validation for numeric inputs, parsing an empty string (`parseInt('')`) yields `NaN`. This prematurely triggers custom validation errors before native HTML5 constraints (like `required`) take effect, leading to a confusing user experience where clearing an input field immediately shows an error.
**Action:** Explicitly handle the empty string state (e.g., `if (this.value === '')`) in the validation logic to clear custom errors and `aria-invalid` attributes, allowing native validation to manage the empty state gracefully.
## 2024-07-20 - 빈 숫자 μž…λ ₯ ν•„λ“œμ— λŒ€ν•œ 인라인 μœ νš¨μ„± 검사 처리 κ°œμ„ 
**Learning:** 숫자 μž…λ ₯ ν•„λ“œμ—μ„œ JavaScript 인라인 μœ νš¨μ„± 검사λ₯Ό κ΅¬ν˜„ν•  λ•Œ, 빈 λ¬Έμžμ—΄μ„ νŒŒμ‹±(`parseInt('')`)ν•˜λ©΄ `NaN`이 λ°˜ν™˜λ©λ‹ˆλ‹€. 이둜 인해 κΈ°λ³Έ HTML5 μ œμ•½ 쑰건(예: `required`)이 μ μš©λ˜κΈ°λ„ 전에 μ‚¬μš©μž μ§€μ • μœ νš¨μ„± 검사 였λ₯˜κ°€ 쑰기에 λ°œμƒν•˜μ—¬, μ‚¬μš©μžκ°€ μž…λ ₯ ν•„λ“œλ₯Ό μ§€μšΈ λ•Œ μ¦‰μ‹œ 였λ₯˜κ°€ λ‚˜νƒ€λ‚˜λŠ” ν˜Όλž€μŠ€λŸ¬μš΄ μ‚¬μš©μž κ²½ν—˜μ„ μ΄ˆλž˜ν•©λ‹ˆλ‹€.
**Action:** 빈 λ¬Έμžμ—΄ μƒνƒœ(예: `if (this.value === '')`)λ₯Ό μœ νš¨μ„± 검사 λ‘œμ§μ—μ„œ λͺ…μ‹œμ μœΌλ‘œ μ²˜λ¦¬ν•˜μ—¬ μ‚¬μš©μž μ§€μ • 였λ₯˜ 및 `aria-invalid` 속성을 ν•΄μ œν•˜κ³ , 빈 μƒνƒœλ₯Ό κΈ°λ³Έ μœ νš¨μ„± 검사가 μžμ—°μŠ€λŸ½κ²Œ κ΄€λ¦¬ν•˜λ„λ‘ κ΅¬ν˜„ν•˜μ‹­μ‹œμ˜€.
12 changes: 10 additions & 2 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,11 @@ async def add_security_headers(request: Request, call_next):
);
});

if (isNaN(val) || val <= 0) {
if (this.value === '') {
preview.innerText = '';
this.setCustomValidity('');
this.removeAttribute('aria-invalid');
} else if (isNaN(val) || val <= 0) {
preview.innerText = 'Must be greater than 0.';
preview.style.color = '#dc3545';
this.setCustomValidity('Must be greater than 0.');
Expand All @@ -282,7 +286,11 @@ async def add_security_headers(request: Request, call_next):
);
});

if (isNaN(val) || val <= 0) {
if (this.value === '') {
preview.innerText = '';
this.setCustomValidity('');
this.removeAttribute('aria-invalid');
} else if (isNaN(val) || val <= 0) {
preview.innerText = 'Must be greater than 0.';
preview.style.color = '#dc3545';
this.setCustomValidity('Must be greater than 0.');
Expand Down
Loading