Skip to content

Commit

Permalink
Address additional feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
rebeccaalpert committed Nov 6, 2024
1 parent f92cebd commit 0995420
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,12 @@ export const ChatbotDemo: React.FunctionComponent = () => {
const handleSkipToContent = (e) => {
e.preventDefault();
if (displayMode === ChatbotDisplayMode.default) {
if (toggleRef.current) {
if (!chatbotVisible && toggleRef.current) {
toggleRef.current.focus();
}
if (chatbotVisible && chatbotRef.current) {
chatbotRef.current.focus();
}
} else {
if (chatbotRef.current) {
chatbotRef.current.focus();
Expand Down
7 changes: 3 additions & 4 deletions packages/module/src/Chatbot/Chatbot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,14 @@ const ChatbotBase: React.FunctionComponent<ChatbotProps> = ({
{/* Ref is intended for use with skip to chatbot links, etc. */}
{/* Motion.div does not accept refs */}
{isVisible ? (
<div
role="region"
<section
aria-label={props['aria-label'] ?? 'Chatbot'}
className={`pf-chatbot-container pf-chatbot-container--${displayMode} ${!isVisible ? 'pf-chatbot-container--hidden' : ''}`}
tabIndex={0}
tabIndex={-1}
ref={innerRef}
>
{children}
</div>
</section>
) : undefined}
</motion.div>
);
Expand Down

0 comments on commit 0995420

Please sign in to comment.