Skip to content

Commit

Permalink
fix(Chatbot): Handle zoom appropriately
Browse files Browse the repository at this point in the history
Allows entire chatbot to scroll like a normal website when zoom is high. Hides jump links since they won't work. Also adds responsive styles to chatbot on docked and overlay.
  • Loading branch information
rebeccaalpert committed Nov 25, 2024
1 parent 3552c88 commit 2e0e521
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/module/src/Chatbot/Chatbot.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@
&--hidden {
pointer-events: none;
}

// 32 rem is the width of the overlay chatbot plus the insets
// if the screen is smaller, we want to be 100%
@media screen and (max-width: 32rem) {
width: 100vw;
inset-inline-end: 0;
}

// allows for zoom conditions; try zooming to 200% to see
@media screen and (max-height: 518px) {
overflow: auto;
}
}

// ============================================================================
Expand All @@ -34,10 +46,22 @@
border-radius: 0;
box-shadow: var(--pf-t--global--box-shadow--lg--left);
overflow: inherit;

// 30rem is the width of the docked chatbot
// if the screen is smaller, we want to be 100%
@media screen and (max-width: 30rem) {
width: 100%;
}
}

html.pf-chatbot-allow--docked {
padding-right: 480px;

// 30rem is the width of the docked chatbot
// if the screen is smaller, we want to be 100%
@media screen and (max-width: 30rem) {
padding-right: 0px;
}
}

// ============================================================================
Expand Down Expand Up @@ -76,6 +100,11 @@ html.pf-chatbot-allow--docked {
&--hidden {
pointer-events: none;
}

// allows for zoom conditions; try zooming to 200% to see
@media screen and (max-height: 518px) {
overflow: auto;
}
}

.pf-chatbot-container--embedded {
Expand Down
5 changes: 5 additions & 0 deletions packages/module/src/ChatbotContent/ChatbotContent.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
overflow-y: auto;
overflow: hidden; // needed in Red Hat Developer Hub workspace
flex: 1; // needed in Composer AI

// allows for zoom conditions; try zooming to 200% to see
@media screen and (max-height: 518px) {
overflow: unset;
}
}

// ============================================================================
Expand Down
5 changes: 5 additions & 0 deletions packages/module/src/MessageBox/JumpButton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@
&--bottom {
inset-block-end: var(--pf-t--global--spacer--md) !important;
}

// allows for zoom conditions; try zooming to 200% to see
@media screen and (max-height: 518px) {
display: none;
}
}
10 changes: 10 additions & 0 deletions packages/module/src/MessageBox/MessageBox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@
flex-direction: column;
row-gap: var(--pf-t--global--spacer--sm);
padding: var(--pf-t--global--spacer--lg);

// 32 rem is the width of the overlay chatbot plus the insets
// if the screen is smaller, we want to be 100%
@media screen and (max-width: 32rem) {
width: 100%;
}
// allows for zoom conditions; try zooming to 200% to see
@media screen and (max-height: 518px) {
overflow-y: visible;
}
}

.pf-chatbot__messagebox--bottom > :first-child {
Expand Down

0 comments on commit 2e0e521

Please sign in to comment.