Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Reinstate Assistant a11y message groups #275

Merged
merged 4 commits into from
Jun 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion src/components/chat-message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { ExecuteIcon } from './icons/execute';
interface ChatMessageProps {
children: React.ReactNode;
isUser: boolean;
id?: string;
id: string;
messageId?: number;
className?: string;
projectPath?: string;
Expand Down
3 changes: 2 additions & 1 deletion src/components/content-tab-assistant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const AuthenticatedView = memo(
{ messages.map( ( message, index ) => (
<ChatMessage
key={ index }
id={ `message-chat-${ index }` }
isUser={ message.role === 'user' }
projectPath={ path }
updateMessage={ updateMessage }
Expand All @@ -67,7 +68,7 @@ const AuthenticatedView = memo(
</ChatMessage>
) ) }
{ isAssistantThinking && (
<ChatMessage isUser={ false }>
<ChatMessage isUser={ false } id="message-thinking">
<MessageThinking />
</ChatMessage>
) }
Expand Down
1 change: 0 additions & 1 deletion src/components/copy-text-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ export function CopyTextButton( {
}
setTimeoutId( setTimeout( () => setShowCopied( false ), timeoutConfirmation ) );
}, [ text, timeoutConfirmation, timeoutId ] );
console.log( 'Icon Size:', iconSize );
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved

return (
<Button
Expand Down
16 changes: 14 additions & 2 deletions src/components/welcome-message-prompt.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { __ } from '@wordpress/i18n';
import { arrowRight } from '@wordpress/icons';
import { cx } from '../lib/cx';

interface WelcomeMessagePromptProps {
children?: React.ReactNode;
id: string;
className?: string;
}

Expand All @@ -19,14 +21,20 @@ interface WelcomeComponentProps {
examplePrompts: string[];
}

export const WelcomeMessagePrompt = ( { children, className }: WelcomeMessagePromptProps ) => (
export const WelcomeMessagePrompt = ( { id, children, className }: WelcomeMessagePromptProps ) => (
<div className={ cx( 'flex mt-2' ) }>
<div
id={ id }
role="group"
aria-labelledby={ id }
className={ cx(
'inline-block p-3 rounded border border-gray-300 lg:max-w-[70%] select-text bg-white',
className
) }
>
<div className="relative">
<span className="sr-only">{ __( 'Studio Assistant' ) },</span>
</div>
<div className="assistant-markdown">
<p>{ children }</p>
</div>
Expand Down Expand Up @@ -67,7 +75,11 @@ const WelcomeComponent = ( {
return (
<div>
{ messages.map( ( message, index ) => (
<WelcomeMessagePrompt key={ index } className="welcome-message">
<WelcomeMessagePrompt
key={ index }
id={ `message-welcome-${ index }` }
className="welcome-message"
>
{ message }
</WelcomeMessagePrompt>
) ) }
Expand Down
Loading