Skip to content

Polish Chat UX and Accessibility#328

Merged
d-oit merged 3 commits into
mainfrom
feat/ux-chat-polish-9567878978023015962
Jun 19, 2026
Merged

Polish Chat UX and Accessibility#328
d-oit merged 3 commits into
mainfrom
feat/ux-chat-polish-9567878978023015962

Conversation

@d-oit

@d-oit d-oit commented Jun 19, 2026

Copy link
Copy Markdown
Owner

Polished the Chat interface by aligning it with the existing design system and improving its accessibility and interaction model. Key changes include refactoring CSS classes to use standard tokens, making suggested actions functional, adding live regions for assistive technologies, and enabling navigation from search citations to the entity editor.


PR created automatically by Jules for task 9567878978023015962 started by @d-oit

@google-labs-jules

Copy link
Copy Markdown
Contributor

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

@github-actions github-actions Bot added config tests Related to automated/manual tests labels Jun 19, 2026
@deepsource-io

deepsource-io Bot commented Jun 19, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 5172ee8...0b83117 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
JavaScript Jun 19, 2026 11:29a.m. Review ↗
Python Jun 19, 2026 11:29a.m. Review ↗
Shell Jun 19, 2026 11:29a.m. Review ↗
SQL Jun 19, 2026 11:29a.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

Comment thread src/features/chat/Chat.tsx Outdated
const debounceRef = useRef<ReturnType<typeof setTimeout> | null>(null);

const handleSend = async (e?: React.FormEvent) => {
const handleSend = async (e?: React.FormEvent, query?: string) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

`handleSend` has a cyclomatic complexity of 7 with "medium" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

Comment thread src/features/chat/Chat.tsx Outdated
<div className="suggested-actions">
<button onClick={() => setInput('Summarize my recent projects')}>Summarize recent projects</button>
<button onClick={() => setInput('Who are the key people?')}>Key people</button>
<button onClick={() => { void handleSend(undefined, 'Summarize my recent projects'); }}>Summarize recent projects</button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expected 'undefined' and instead saw 'void'


The void operator takes an operand and returns undefined. It can be used to ignore the value produced by an expression. However, this can lead to code that is difficult to understand and maintain. Historically, the void operator was used to get a "pure" undefined value, as the undefined variable was mutable prior to ES5.

Comment thread src/features/chat/Chat.tsx Outdated
<button onClick={() => setInput('Summarize my recent projects')}>Summarize recent projects</button>
<button onClick={() => setInput('Who are the key people?')}>Key people</button>
<button onClick={() => { void handleSend(undefined, 'Summarize my recent projects'); }}>Summarize recent projects</button>
<button onClick={() => { void handleSend(undefined, 'Who are the key people?'); }}>Key people</button>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expected 'undefined' and instead saw 'void'


The void operator takes an operand and returns undefined. It can be used to ignore the value produced by an expression. However, this can lead to code that is difficult to understand and maintain. Historically, the void operator was used to get a "pure" undefined value, as the undefined variable was mutable prior to ES5.

Comment thread src/features/chat/Chat.tsx Outdated

<form className="ask-composer" onSubmit={e => void handleSend(e)}>
<div className="input-container">
<form className="chat-controls" onSubmit={e => void handleSend(e)}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expected 'undefined' and instead saw 'void'


The void operator takes an operand and returns undefined. It can be used to ignore the value produced by an expression. However, this can lead to code that is difficult to understand and maintain. Historically, the void operator was used to get a "pure" undefined value, as the undefined variable was mutable prior to ES5.

@codacy-production

codacy-production Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 5 complexity · 0 duplication

Metric Results
Complexity 5
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

d-oit added a commit that referenced this pull request Jun 19, 2026
…t polish (#329)

* feat(ui): implement GOAP plan tasks - tokens, overlay, responsive, chat polish

- Fix PR #328 DeepSource issues: reduce cyclomatic complexity, fix void operator usage
- Add missing CSS token aliases (--border-color, --surface-primary/secondary)
- Add semantic token families (status, entity, graph, control-height, z-index, focus-ring)
- Add prefers-reduced-motion policy
- Create Overlay primitive with focus trap, Escape, scroll lock
- Create useScrollLock hook
- Fix 100vh → 100dvh with fallback for mobile viewport
- Add safe-area insets for notched devices
- Add viewport-fit=cover for iOS
- Fix touch targets (44px) for coarse pointers
- Fix graph/mindmap canvas height with clamp()
- Update plans/INDEX.md with new plan and ADR entries

* fix(ui): address DeepSource issues - arrow functions, void operator, global scope

* fix(chat): resolve Codacy issues - proper keys, button types, suppress false positives

* fix(test): update E2E test to use correct chat-view class selector

* fix(test): update E2E test to use correct message class selector

---------

Co-authored-by: d-oit <do-it@ik.me>
Comment thread src/features/chat/Chat.tsx Outdated
return `I couldn't find any direct matches in your local library for "${queryText}". You might want to try different keywords or add more context to your entities.`;
};

const handleSend = async (e?: React.FormEvent, query?: string) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

`handleSend` has a cyclomatic complexity of 6 with "medium" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

Comment thread src/features/chat/Chat.tsx Outdated
</div>
</div>
)}
{messages.map((m, i) => (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Function has a cyclomatic complexity of 6 with "medium" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

Comment thread src/features/chat/Chat.tsx Outdated
)}
{messages.map((m, i) => (
<div key={i} className={`message-wrapper ${m.role}`}>
<div key={i} className={`message ${m.role}`}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do not use Array index in keys


When rendering a list of items in React, it is necessary to pass a "key" prop.
This key is used by React to identify which items have changed, are added, or are removed and should be stable.
It is not recommended to use the index of an element as key because it doesn't uniquely identify the element.
When elements are added/removed from an array, the index of an element may change, which will result in unnecessary re-renders.

Comment thread src/features/chat/Chat.tsx Outdated
Comment on lines +26 to +31
const ChatMessage: React.FC<{
message: Message;
showSources: boolean;
onToggleSources: () => void;
onNavigate?: (id: string) => void;
}> = ({ message, showSources, onToggleSources, onNavigate }) => (

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

`ChatMessage` has a cyclomatic complexity of 6 with "medium" risk


A function with high cyclomatic complexity can be hard to understand and
maintain. Cyclomatic complexity is a software metric that measures the number of
independent paths through a function. A higher cyclomatic complexity indicates
that the function has more decision points and is more complex.

@github-actions github-actions Bot removed the tests Related to automated/manual tests label Jun 19, 2026
…mproved flow

- Refactor Chat component: extract ChatMessage, CitationsPanel components
- Add canSend/scheduleDebounceReset helpers to reduce complexity
- Use stable message.id keys instead of array index
- Wrap void arrow functions with braces
- Add searching-indicator CSS class, remove inline styles
- Add onNavigate prop for citation navigation to entity editor
- Update e2e tests for new chat class names
- Pass onNavigate through App.tsx to Chat component
@d-oit d-oit force-pushed the feat/ux-chat-polish-9567878978023015962 branch from 5714523 to 56d4702 Compare June 19, 2026 11:43
…mproved flow

- Standardized CSS classes in Chat.tsx to match design system tokens.
- Implemented functional suggested actions that trigger searches.
- Replaced custom loading indicator with semantic Loader2 icon.
- Added role="log" and aria-live="polite" for screen reader support.
- Enabled navigation from citations back to the editor via onNavigate.
- Refactored Chat.tsx into smaller components (ChatMessage, CitationsPanel).
- Ensured E2E tests are aligned with the new structure.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
@github-actions github-actions Bot added the documentation Documentation improvements label Jun 19, 2026
- Standardized CSS classes in Chat.tsx to match design system tokens and features.css.
- Implemented functional suggested actions that trigger searches immediately.
- Replaced custom loading indicator with semantic Loader2 icon and animate-spin utility.
- Added role="log" and aria-live="polite" for better screen reader support.
- Enabled navigation from citations back to the editor via onNavigate prop.
- Refactored Chat.tsx into smaller components (ChatMessage, CitationsPanel) with standard function declarations to resolve linting false positives.
- Fixed unhandled promises in event handlers to satisfy ESLint rules.
- Updated E2E tests to reflect class renames and ensure continued stability.

Co-authored-by: d-oit <6849456+d-oit@users.noreply.github.com>
@d-oit d-oit merged commit 4d63a69 into main Jun 19, 2026
21 checks passed
@d-oit d-oit deleted the feat/ux-chat-polish-9567878978023015962 branch June 19, 2026 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config documentation Documentation improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants