Skip to content

🎨 Palette: 빈 문자열에 대한 인라인 유효성 검사 초기화 - #301

Closed
seonghobae wants to merge 1 commit into
mainfrom
jules-13325796297207445970-1251500a
Closed

🎨 Palette: 빈 문자열에 대한 인라인 유효성 검사 초기화#301
seonghobae wants to merge 1 commit into
mainfrom
jules-13325796297207445970-1251500a

Conversation

@seonghobae

@seonghobae seonghobae commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

💡 What: 숫자 입력 필드(target_bytes, batch_target_bytes)에서 값이 비워졌을 때 커스텀 유효성 검사 오류와 aria-invalid 상태를 명시적으로 초기화하도록 수정했습니다.
🎯 Why: 값을 지웠을 때 커스텀 오류 메시지(예: "Must be greater than 0.")가 남아있으면 브라우저의 기본 required 제약 조건 메시지를 덮어쓰게 되어 사용자가 혼란을 겪을 수 있습니다.
📸 Before/After: N/A
♿ Accessibility: 입력값이 비워졌을 때 스크린 리더가 이전의 잘못된 상태를 계속 읽는 문제를 방지하기 위해 aria-invalid 속성을 올바르게 제거했습니다.


PR created automatically by Jules for task 13325796297207445970 started by @seonghobae

Summary by CodeRabbit

  • 버그 수정

    • 숫자 입력란을 비웠을 때 이전 오류 상태와 잘못된 유효성 메시지가 남지 않도록 수정했습니다.
    • 입력값 삭제 시 미리보기와 오류 표시가 즉시 초기화됩니다.
    • 필수 입력 및 숫자 범위 검사가 빈 입력과 올바르게 구분됩니다.
  • 문서

    • 숫자 입력의 빈 문자열 처리 및 인라인 유효성 검사 지침을 추가했습니다.

Copilot AI review requested due to automatic review settings July 27, 2026 17:29
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

숫자 입력이 빈 문자열이 되면 미리보기와 커스텀 유효성, aria-invalid 상태를 초기화하도록 target_bytesbatch_target_bytes 검증 로직 및 관련 안내가 수정되었습니다.

Changes

숫자 입력 유효성 검사

Layer / File(s) Summary
빈 입력 상태 초기화
saas_web.py, .jules/palette.md
target_bytesbatch_target_bytes가 비어 있을 때 미리보기와 커스텀 유효성 상태를 초기화하고 aria-invalid를 제거합니다. 동일한 처리 규칙이 안내 문서에 추가되었습니다.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 빈 문자열 입력 시 인라인 유효성 검사와 상태 초기화라는 핵심 변경을 간결하게 잘 요약합니다.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-13325796297207445970-1251500a

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the FastAPI UI template’s inline JavaScript validation so that when numeric inputs are cleared, any prior custom validity error and aria-invalid state are explicitly reset—preventing stale error messaging from overriding native HTML5 required behavior and avoiding incorrect screen reader announcements.

Changes:

  • Add explicit empty-string handling for target_bytes input validation (clear preview, clear custom validity, remove aria-invalid).
  • Add the same empty-string handling for batch_target_bytes.
  • Document the pattern/learning in .jules/palette.md.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
saas_web.py Resets custom validation + aria-invalid when numeric inputs are emptied (single + batch forms).
.jules/palette.md Records the UI validation learning/action for empty numeric input states.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread saas_web.py
Comment on lines +258 to +262
if (this.value === '') {
preview.innerText = '';
this.setCustomValidity('');
this.removeAttribute('aria-invalid');
} else if (isNaN(val) || val <= 0) {

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@saas_web.py`:
- Around line 258-262: Update both handlers’ empty-value branches to require
this.value === '' && !this.validity.badInput before clearing the preview, custom
validity, and aria-invalid state. Preserve the existing invalid-number handling
for badInput cases so malformed numeric input retains its feedback.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8357fc08-fd80-4a84-b50c-a7d8acdba903

📥 Commits

Reviewing files that changed from the base of the PR and between 5a92586 and 1f13bb2.

📒 Files selected for processing (2)
  • .jules/palette.md
  • saas_web.py

Comment thread saas_web.py
Comment on lines +258 to +262
if (this.value === '') {
preview.innerText = '';
this.setCustomValidity('');
this.removeAttribute('aria-invalid');
} else if (isNaN(val) || val <= 0) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate the file and inspect the relevant lines with context.
git ls-files | rg '(^|/)saas_web\.py$'
printf '\n--- file excerpt ---\n'
nl -ba saas_web.py | sed -n '240,310p'

Repository: ContextualWisdomLab/codec-carver

Length of output: 244


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n--- saas_web.py excerpt ---\n'
sed -n '240,310p' saas_web.py | cat -n

printf '\n--- badInput references ---\n'
rg -n 'badInput|validity\.badInput|setCustomValidity|removeAttribute\('"'"'aria-invalid'"'"'\)' saas_web.py

Repository: ContextualWisdomLab/codec-carver

Length of output: 4998


🌐 Web query:

input type=number validity.badInput value empty invalid characters browser behavior MDN

💡 Result:

In an input element of type number, the validity.badInput property is a boolean that indicates whether the user has entered text that the browser cannot convert into a valid numerical value [1][2]. Browser Behavior When a user enters characters that are not part of a valid number (for example, typing letters into a number input), the browser deems the input invalid [3]. A key behavior of type=number inputs is how they handle the.value property in these situations: 1. Invalid Input: If the user enters a non-numeric string, the element's.value property will typically return an empty string (""), even though the input field itself visually contains the invalid characters [4]. 2. Detection: Because.value returns an empty string for both a truly empty field and an field with invalid non-numeric text, you cannot rely on.value alone to distinguish between them [4]. Instead, you must check the validity.badInput property [1][4]. 3. Validity State: If validity.badInput is true, it explicitly indicates that the browser is unable to convert the current raw input into a number [1][2][5]. Summary of Key Differences: - Empty Input: If the field is empty, validity.badInput is false. (Note: validity.valueMissing will be true if the required attribute is present) [3][4]. - Invalid Characters: If the field contains non-numeric characters (e.g., 'abc'), validity.badInput is true, and the element is considered invalid [1][3][4]. To identify the state of the input, you can use the following logic: if (input.validity.badInput) { // The user entered invalid characters (e.g., letters) } else if (input.value === "") { // The input is genuinely empty } else { // The input contains a valid number }

Citations:


빈 값 처리에서 badInput을 제외해 주세요.
<input type="number">는 잘못된 문자 입력 시 value === ''처럼 보일 수 있습니다. 지금처럼 빈 값만 기준으로 미리보기와 aria-invalid를 지우면, 잘못된 숫자 입력의 피드백이 사라질 수 있으니 두 핸들러 모두 this.value === '' && !this.validity.badInput로 분기해 주세요.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@saas_web.py` around lines 258 - 262, Update both handlers’ empty-value
branches to require this.value === '' && !this.validity.badInput before clearing
the preview, custom validity, and aria-invalid state. Preserve the existing
invalid-number handling for badInput cases so malformed numeric input retains
its feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants