Skip to content

fix(ux): show inline validation feedback for empty api key#859

Open
Abhi666-max wants to merge 2 commits into
shouri123:mainfrom
Abhi666-max:fix-api-key-validation
Open

fix(ux): show inline validation feedback for empty api key#859
Abhi666-max wants to merge 2 commits into
shouri123:mainfrom
Abhi666-max:fix-api-key-validation

Conversation

@Abhi666-max

@Abhi666-max Abhi666-max commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Description

Added an inline validation error message to the popup UI. Previously, submitting an empty API key only triggered a shake animation without any text feedback. Now, an explicit "API key cannot be empty" message appears below the input to improve UX. Added an event listener to clear the error state as soon as the user starts typing.

Fixes #858

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Summary by CodeRabbit

  • Bug Fixes
    • Added a visible inline error message when the API key is missing during setup.
    • The error message now appears on save failure and clears automatically as soon as the user starts typing again.
    • The existing input shake behavior remains, but users now get clearer feedback about what needs to be fixed.

@Abhi666-max
Abhi666-max requested a review from shouri123 as a code owner July 7, 2026 07:01
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

🚀 Thank You for Contributing to Late-Meet

Please ensure that:

  • the issue was assigned to you before opening this PR
  • the PR references the related issue
  • your changes follow repository contribution guidelines
  • the project builds successfully before submission

Unassigned, duplicate, or low-quality PRs may be closed.

Thank you for contributing 💙

@github-actions github-actions Bot added gssoc Official GSSoC contribution issue gssoc:approved GSSoC: PR approved and scored bug Something isn't working size/S type:design Type: Design / UI / UX (Optional bonus) type:code Type: Code change type:docs Type: Documentation type:feature Type: New Feature labels Jul 7, 2026
@github-actions

github-actions Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

👋 Thank you @Abhi666-max for your contribution to Late-Meet!

✅ Verified: You are assigned to the linked issue #858.

Please review any automated suggestions or code review comments that may appear below! We will review your PR as soon as possible!


Please consider starring the repository ⭐ to show your support!

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@Abhi666-max, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d8d779c2-ff04-4f22-a87d-874d420ae303

📥 Commits

Reviewing files that changed from the base of the PR and between 4c5c06e and f1a8edc.

📒 Files selected for processing (2)
  • src/popup.html
  • src/popup.ts
📝 Walkthrough

Walkthrough

Adds a hidden inline error message element in the popup's setup view for API key validation. Updates popup.ts to display this error when an empty API key is submitted and hide it when the user begins typing in the input field.

Changes

API key validation feedback

Layer / File(s) Summary
Inline error element and display logic
src/popup.html, src/popup.ts
Adds a hidden #api-key-error span styled in red under the API key input; the save-keys handler shows it when the input is empty, and a new input event listener hides it once the user starts typing.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PopupUI
  participant PopupTS

  User->>PopupUI: Click "save keys" with empty api-key-input
  PopupTS->>PopupTS: Detect empty apiKey
  PopupTS->>PopupUI: Set api-key-error display = block
  User->>PopupUI: Start typing in api-key-input
  PopupUI->>PopupTS: input event fired
  PopupTS->>PopupUI: Set api-key-error display = none
Loading
🚥 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 The title clearly matches the main change: inline validation feedback for empty API key submission.
Linked Issues check ✅ Passed The changes add an inline error message and clear it on typing, which matches the linked UX requirements.
Out of Scope Changes check ✅ Passed The PR stays focused on empty API key validation feedback and does not ցույց unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (4)
src/popup.html (2)

67-69: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Inline styling duplicates existing passphrase-status pattern.

Consider extracting a shared .field-error CSS class instead of repeating inline styles (as done for passphrase-status above), for consistency and easier theming later.

🤖 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 `@src/popup.html` around lines 67 - 69, The API key error message in the popup
uses repeated inline styles instead of the shared styling pattern already used
by passphrase-status. Update the api-key-error element in popup.html to use a
reusable .field-error class and move the shared error presentation rules into
the stylesheet so both fields stay consistent and easier to theme.

67-69: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add role="alert"/aria-live and associate error with input for screen readers.

The error message is toggled purely via inline display styling with no ARIA live region, so screen reader users won't be notified when it appears. Also, it isn't linked to api-key-input via aria-describedby, so assistive tech won't announce it in field context.

♿ Proposed fix
-            <input type="password" id="api-key-input" class="setup-input" placeholder="sk-..." />
+            <input
+              type="password"
+              id="api-key-input"
+              class="setup-input"
+              placeholder="sk-..."
+              aria-describedby="api-key-error"
+            />
-          <span id="api-key-error" style="color: `#ef4444`; font-size: 12px; display: none; margin-top: 4px;">API key cannot be
-            empty</span>
+          <span id="api-key-error" role="alert" style="color: `#ef4444`; font-size: 12px; display: none; margin-top: 4px;">API key cannot be
+            empty</span>

Accessibility guidance recommends associating error text with inputs via aria-describedby and using a live region (e.g. role="alert") so dynamically shown errors are announced.

🤖 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 `@src/popup.html` around lines 67 - 69, Add accessibility attributes to the API
key validation message so it is announced by assistive tech: update the
api-key-error element to use an alert/live region role, and link it to
api-key-input with aria-describedby. Make sure the error remains toggled
visually as before, but the input and error message are semantically connected
so screen readers announce the message in context when it appears.
src/popup.ts (2)

108-109: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Consider setting aria-invalid on the input alongside showing the error.

The error span is shown, but the associated api-key-input isn't marked invalid, so screen reader users navigating by field won't get the failure context. Pairing this with the aria-describedby/role="alert" suggestion in popup.html would close this gap.

🤖 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 `@src/popup.ts` around lines 108 - 109, The API key validation flow in popup.ts
shows the error message but does not mark the input as invalid, so update the
api-key-input handling in the same branch that toggles api-key-error to also set
aria-invalid on the input when validation fails and clear it when the error is
dismissed or the field becomes valid. Use the existing popup.ts validation logic
and the api-key-input/api-key-error elements together so screen readers get the
invalid-field context alongside the visible error state.

758-768: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use optional chaining per static analysis hint.

🔧 Proposed fix
-    apiInputBox.addEventListener('input', () => {
-        const errorMsg = document.getElementById('api-key-error');
-        if (errorMsg && errorMsg.style.display === 'block') {
-            errorMsg.style.display = 'none';
-        }
-    });
+    apiInputBox.addEventListener('input', () => {
+        const errorMsg = document.getElementById('api-key-error');
+        if (errorMsg?.style.display === 'block') {
+            errorMsg.style.display = 'none';
+        }
+    });

As per static analysis hints, "Prefer using an optional chain expression instead, as it's more concise and easier to read."

🤖 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 `@src/popup.ts` around lines 758 - 768, The `apiInputBox`/`api-key-error` DOM
lookup and guard logic in `popup.ts` should be simplified using optional
chaining as suggested by static analysis. Update the `apiInputBox` check and the
`errorMsg` visibility check in the input listener to use optional chain
expressions instead of nested `if` guards, while keeping the same behavior in
the API key error-clearing flow.

Source: Linters/SAST tools

🤖 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.

Nitpick comments:
In `@src/popup.html`:
- Around line 67-69: The API key error message in the popup uses repeated inline
styles instead of the shared styling pattern already used by passphrase-status.
Update the api-key-error element in popup.html to use a reusable .field-error
class and move the shared error presentation rules into the stylesheet so both
fields stay consistent and easier to theme.
- Around line 67-69: Add accessibility attributes to the API key validation
message so it is announced by assistive tech: update the api-key-error element
to use an alert/live region role, and link it to api-key-input with
aria-describedby. Make sure the error remains toggled visually as before, but
the input and error message are semantically connected so screen readers
announce the message in context when it appears.

In `@src/popup.ts`:
- Around line 108-109: The API key validation flow in popup.ts shows the error
message but does not mark the input as invalid, so update the api-key-input
handling in the same branch that toggles api-key-error to also set aria-invalid
on the input when validation fails and clear it when the error is dismissed or
the field becomes valid. Use the existing popup.ts validation logic and the
api-key-input/api-key-error elements together so screen readers get the
invalid-field context alongside the visible error state.
- Around line 758-768: The `apiInputBox`/`api-key-error` DOM lookup and guard
logic in `popup.ts` should be simplified using optional chaining as suggested by
static analysis. Update the `apiInputBox` check and the `errorMsg` visibility
check in the input listener to use optional chain expressions instead of nested
`if` guards, while keeping the same behavior in the API key error-clearing flow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 53fa8646-7a8e-4d1f-9c80-00ce7c7bf910

📥 Commits

Reviewing files that changed from the base of the PR and between d216444 and 4c5c06e.

📒 Files selected for processing (2)
  • src/popup.html
  • src/popup.ts

@github-actions github-actions Bot removed the type:docs Type: Documentation label Jul 7, 2026
@sonarqubecloud

sonarqubecloud Bot commented Jul 7, 2026

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown
Contributor

This PR has been marked as stale due to inactivity.

@github-actions github-actions Bot added the stale label Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working gssoc:approved GSSoC: PR approved and scored gssoc Official GSSoC contribution issue size/S stale type:code Type: Code change type:design Type: Design / UI / UX (Optional bonus) type:feature Type: New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix(UX): Show inline validation feedback for empty API key submission in the popup

1 participant